Ok, so I can write a shell script with bash, sh, or zsh in mind etc. And I can put a hashbang at the top of the file like so:#!/usr/bin/env bashwhich will tell the kernel which interpreter to use to execute the file.However, I just realized, I don't know how to tell the machine which interpreter to use at the command line.e.g., if I write:$ foo bar bazat the command line, how do I know what interpreter is being used to interpret that command? How can I tell the computer to use a particular interpreter?Hopefully the question is clear.
Specify which interpreter to use at command line
bash;shell script;shell;zsh
To get your login shell, which is most likely the shell you're currently running, unless you have deliberately chosen a different shell (e.g., by choosing a shell other than your login shell in your terminal emulator's preferences, or by explicitly invoking a shell at login time, such as with ssh remote-host /path/to/shell):echo $SHELLTo use a different shell:exec /path/to/shellE.g.:exec /bin/bash