Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support #!/usr/bin/env #21

Open
cheecheeo opened this issue Aug 11, 2016 · 8 comments
Open

Support #!/usr/bin/env #21

cheecheeo opened this issue Aug 11, 2016 · 8 comments

Comments

@cheecheeo
Copy link

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
@neurobin
Copy link
Owner

neurobin commented Aug 11, 2016

Please checkout the 3.9.4a branch and report if possible.

@cheecheeo
Copy link
Author

@neurobin

% shc -h       
shc Version 3.9.4a, Generic Shell Script Compiler
shc GNU GPL Version 3 Jahidul Hamid <jahidulhamid@yahoo.com>
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.

@neurobin neurobin reopened this Aug 12, 2016
@neurobin
Copy link
Owner

neurobin commented Aug 26, 2017

Currently there is no plan to add this feature.

@intika
Copy link
Contributor

intika commented Nov 12, 2018

Can you please check the current version with the H flag and report back

@evils
Copy link

evils commented Jan 25, 2020

@intika 4.0.3 has this with and without -H

@Hayao0819
Copy link

I'm running into a similar problem.I want to support env.

@felipecrs
Copy link

How to work around it in the command line?

shc -x /bin/bash does not help

@leowill01
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants