Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To write a bash script in zsh, follow these steps:

  1. Open your preferred text editor.

  2. On the top of the script, add the following line:

#!/bin/bash

This tells the system to use bash to interpret the script.

  1. Write the script as you would normally in bash, using any of the bash commands and syntax.

  2. Save the file with a .sh extension.

  3. Make the script executable by running the following command in the terminal:

+x scriptname.sh

  1. Run the script by typing its name into the terminal:

./scriptname.sh