Executing shell scripts

Expertise level: Easy

What are shell scripts?

Shell scripts are executable files, that contain one or more SSH commands grouped together.

These commands will be run one-by-one, when you execute the script file from the shell. 

Follow the steps mentioned below to execute a shell script:

  • Login with SSH as root.
  • Navigate to the directory where the script is residing using the cd command.
cd /path/to/file/
  • Your script file must have executable permissions, if not, change the permissions to 755.

(For example, your shell script file is named script.sh)

chmod 755 script.sh
  • To execute the script, just type the following command from the same directory where the script file exist:
./script.sh
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk