Target doesn't have to be binary.

Story: Bash ShebangTotal Replies: 1
Author Content
cr

Jul 24, 2019
9:21 AM EDT
> Interpreter is the full path to a binary file (ex: /bin/sh, /bin/bash).

...Or to anything capable of interpreting the file's contents. I've set up executable RC-files for text conversion where the shebang line calls out a Perl script I wrote, and the process works just fine: the RCfile's shebang line, "#!/usr/local/bin/splitmake" (plus args, including a self-reference) invokes splitmake, a script with a shebang line of "#!/usr/bin/perl -w", and the script's args get passed to the Perl interpreter just fine. The one tricky part I found is that, as noted, "splitmake" needs a commandline-option specifying the name of the RCfile it's supposed to read in and use.

That's just with messing around because I wanted to see if it would work, in the time it took to bring this project up. Somebody with some serious time to kill might discover how to get that calling program's path/name passed; maybe it's in the ENV.
mbaehrlxer

Jul 24, 2019
8:46 PM EDT
that is interesting. could you share some examples?

i assume you already checked args[0] (or whatever the equivalent is in perl) and its value is "splitmake" and not the name of the script calling splitmake?

if that's the case then i suspect that the value is replaced in the chain of processing these scripts because i would have expected the name from the commandline script to be there, just like in a regular script the value is the name of the script and not of the interpreter.

greetings, eMBee.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!