1 | initial version |
To create a shell script using the command line, follow these steps:
Open the terminal or command prompt.
Navigate to the location where you want to create the script.
Type touch script.sh
and press Enter to create a new file named "script.sh" (replace "script" with the desired name of your script).
Type chmod +x script.sh
and press Enter to give the file executable permissions.
Type nano script.sh
and press Enter to open the file in the Nano text editor (you can use any text editor of your preference).
Add your script commands to the file. For example:
#!/bin/bash
echo "Hello World!"
Your shell script is now ready to be executed by running ./script.sh
from the terminal/command prompt.