[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

detect shell script language


I need to detect the actual programming language of a script.

A way of detecting it is to examine the first line searching for the "sha-bang" (#!), e.g.,




However, there are cases where this is not enough, since the script, although it has #!/bin/sh is actually written (and interpreted) in another language, e.g., Tcl.

So my question is, is there another way of detecting the actual language? I mean, another convention?

Another guy told me that a possible way is to use, on the second line a pattern like

-*- <interpreter> -*-

and I found some tcl scripts that look like this.

Is there a specific standard convention?

many thanks in advance

|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |

Reply to: