shc
shc copied to clipboard
Support `#!/usr/bin/env`
I'm not sure if this is outside the scope of this project, but it would be nice if the #!/usr/bin/env pattern.
% cat bisect.sh
#!/usr/bin/env bash
set -ex
export NIXPKGS=${NIXPKGS:-$HOME/packages/nixpkgs}
nix-env --file "$NIXPKGS" -iA autojump
autojump --help
% shc -U -f bisect.sh
shc Unknown shell (env): specify [-i][-x][-l]
shc: Success
Please checkout the 3.9.4a branch and report if possible.
@neurobin
% shc -h
shc Version 3.9.4a, Generic Shell Script Compiler
shc GNU GPL Version 3 Jahidul Hamid <[email protected]>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-o outfile] [-rvDUCABh] -f script
-e %s Expiration date in dd/mm/yyyy format [none]
-m %s Message to display upon expiration ["Please contact your provider"]
-f %s File name of the script to compile
-i %s Inline option for the shell interpreter i.e: -e
-x %s eXec command, as a printf format i.e: exec('%s',@ARGV);
-l %s Last shell option i.e: --
-o %s output filename
-r Relax security. Make a redistributable binary
-v Verbose compilation
-D Switch ON debug exec calls [OFF]
-U Make binary untraceable [no]
-C Display license and exit
-A Display abstract and exit
-B Compile for busybox
-h Display help and exit
Environment variables used:
Name Default Usage
CC cc C compiler command
CFLAGS <none> C compiler flags
Please consult the shc man page.
% shc -U -f bisect.sh
% ./bisect.sh.x
./bisect.sh.x: invalid option -- 'c'
Try `./bisect.sh.x --help' for more information.
Currently there is no plan to add this feature.
Can you please check the current version with the H flag and report back
@intika 4.0.3 has this with and without -H
I'm running into a similar problem.I want to support env.
How to work around it in the command line?
shc -x /bin/bash does not help
This would be very useful because if I'm not mistaken, the compiled script is at the mercy of whatever version of the shebang shell the operator has on their system and not the version the script was developed with. I guess one could add a check for the version of /usr/bin/bash being used, but this would still be a useful option to have.