1 | initial version |
To write a bash script in zsh, follow these steps:
Open your preferred text editor.
On the top of the script, add the following line:
#!/bin/bash
This tells the system to use bash to interpret the script.
Write the script as you would normally in bash, using any of the bash commands and syntax.
Save the file with a .sh extension.
Make the script executable by running the following command in the terminal:
+x scriptname.sh
./scriptname.sh