-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Lorenzo Bettini wrote: > Ron Johnson wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Lorenzo Bettini wrote: >>> Hi >>> >>> 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., >>> >>> #!/bin/bash >>> >>> or >>> >>> #!/usr/bin/perl >>> >>> 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? >> >> Is this internal to the script, or external (looking in)? >> > > I need to detect the language of the script in order to highlight it > accordingly (GNU source-highlight http://www.gnu.org/software/src-highlite) > > for instance I have some tcl scripts that start as follows: > > #!/bin/sh > # Tcl ignores the next line -*- tcl -*- \ > exec wish "$0" -- "$@" > > and I want them to be colorized as a Tcl script instead of a shell script > >> I don't think that you can accurately do what you want, because a >> script can call multiple interpreters.
IOW, "wish" is a Tcl script? - -- Ron Johnson, Jr. Jefferson LA USA Is "common sense" really valid? For example, it is "common sense" to white-power racists that whites are superior to blacks, and that those with brown skins are mud people. However, that "common sense" is obviously wrong. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE+Ag6S9HxQb37XmcRAo7sAJ4jrw5jDb9o24Tdrko14n9dliC+5wCgs3w4 sTx21WrmMOaqu71yaYKf/T0= =gIKx -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

