We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
I have an old Mac running Snow Leopard with a newer zsh installed in /opt/local/bin, so I symlinked it to /usr/bin. But my script wouldn't run on a newer Mac because zsh is installed in /bin, and system protection won't let you symlink it to /usr/bin. This fixes it. Thanks!
Well, some functions are different in other shells. I'm not sure if it is good idea to use your way but I'll test it out. Other sad thing is Apple is still shipping with the old Bash. Old Bash does not support Associative Array for instance :(
You are still using the same shell (say, bash) when you use "#!/usr/bin/env bash", the only difference is that the person running this script can have bash installed anywhere, and as long it can be find in the $PATH, things will work just fine.
well... environment should handle the target location. for example I use homebrew and I use brews python. when I call #!/usr/bin/env python brew's python runs. because its in the path. doesn't matter if you set bash anywhere else unless you should point out in the $PATH variable. You can even set path in she-bang line. -S -P option... I'm assuming that we are on mac os.
Also; this works:
#!/usr/bin/env ruby -w
puts RUBY_VERSION
(osx el capitan, rbenv, ruby 2.2.2)
thats the main idea of env. env knows all of it. which is where...
I'm not sure if I understand what's your point. That's exactly what I'm saying in the post, you should use "#!/usr/bin/env python" instead of ""#!/usr/bin/python" because the former will use whatever is in your $PATH, while the later will assume that python exists in that specific location.
oops :) I've totally misunderstood . we are on the same page :)))) sorry... long day i guess :) time for beer! on me :)
Cheers!
My bash script is working fine i have used #!bin/bash in shebang but when i run it on zsh shell is shows bad subsitution error
#!bin/zsh and the problem is solved.
But how can we make the script run in both shell