[HTML payload içeriği buraya]
29.9 C
Jakarta
Monday, May 18, 2026

bash – /usr/bin/env and command with pound image in it


I need to use nix shell in my shebang. The problem is that nix shell makes use of # image as a part of flake identify and env command on macOS acts a bit wired with this image. For instance if you’ll create shebang like this:

$ cat ./check
#!/usr/bin/env -v echo one#two

env will simply lower off #two half:

$ ./check
#env executing: echo
#env    arg[0]= 'echo'
#env    arg[1]= 'one'
#env    arg[2]= './check'
one ./check

as if it thought #two is a remark in shell script. I can not discover any clarification for such habits in man pages. There’s some phrases about # in context of -S possibility, however I don’t use this selection and # isn’t within the begin of the argument.

Is there anybody who understands what occurs right here? Or perhaps he is aware of the place I can discover env supply code for my system?

macOS model 14.5

UPD:
On the finish of the day I need to do one thing like this (besides script is for much longer, I’ve simply tried to point out the thought):

#!/usr/bin/env -S nix shell nixpkgs#curl nixpkgs#jq --command sh

curl -s 'https://api.ipify.org?format=json' | jq -r '.ip'

which works simply nice on Linux hosts however I can not make it work on macOS.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles