Linux doesn’t generally use extensions to decide what shell to use, so it doesn’t matter if it’s an sh file or not.
If it uses bash of course you can substitute #!/bin/bash
And of course you can use whatever shell you want, just saying that POSIX-compliance is not really relevant since the script can specify what shell it needs.
The file extension doesn’t matter much on Linux. If you’ve got a shebang at the top, the shell you’re running from will invoke the correct shell according to the shebang.
In some situations, you may want to use something like bash <your-script>, but that would only be when you’ve got a script that doesn’t have a shebang, but not having one is bad practice and you really should be using them. Fish isn’t the only non-POSIX shell you’re going to encounter on a Linux system. Python, Perl, and probably some others will be there, and using a shebang ensures no shenanigans. So whether or not you use Fish, you should always use shebangs.
how about if its not in a sh file,its common for scripts to use sh or bash instead. but am just gonna stick to ZSH anyways
Linux doesn’t generally use extensions to decide what shell to use, so it doesn’t matter if it’s an sh file or not.
If it uses bash of course you can substitute #!/bin/bash
And of course you can use whatever shell you want, just saying that POSIX-compliance is not really relevant since the script can specify what shell it needs.
The file extension doesn’t matter much on Linux. If you’ve got a shebang at the top, the shell you’re running from will invoke the correct shell according to the shebang.
In some situations, you may want to use something like
bash <your-script>, but that would only be when you’ve got a script that doesn’t have a shebang, but not having one is bad practice and you really should be using them. Fish isn’t the only non-POSIX shell you’re going to encounter on a Linux system. Python, Perl, and probably some others will be there, and using a shebang ensures no shenanigans. So whether or not you use Fish, you should always use shebangs.