Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Best practices for managing aliases in ohmyzsh?




No.  "#!" is a comment, because it begins with "#".

Correct. #! is treated as "magic" sequence by the OS. It's only looked for when you first execute a file. Otherwise it is treated as a command and ignored.

Here's more information than you could possibly read through: https://www.in-ulm.de/~mascheck/various/shebang/



What if you source a file with another shell's shebang?

Sufficiently portably written shell code might work, and there are
some tricks you can do in some languages that have superficial
similarities so that incorrect interpreters can recognize themselves
and do a backflip, but for the most part it is indeed "barf."

The shebang line will get ignored, as you pointed. Any code will be interpreted as the shell of the parent sourcing the file. If the script was written in bash but happens to run fine in zsh, it will work perfectly fine.




Messages sorted by: Reverse Date, Date, Thread, Author