How to create a Shell Script & execute it in Linux/Unix?

How to create a Shell Script & execute it in Linux/Unix?

Senior Developer Asked on December 7, 2017 in LINUX.
Add Comment
1 Answer(s)

{1} Open a text editor you want to write the script. It can be a command-line editor like vi.
{2} Add the following lines:


#!/bin/bash

echo "Hi Aviance user!"

{3} Save the file in the your workplace as “welcome.sh”.
{4} Move from the text editor to a command shell.
{5} From the command shell, type this to terminal:


$ chmod +x welcome.sh

{6} To execute the script, type this to terminal:


$ ./welcome.sh

OUTPUT: Hi Aviance user!

IT Head Answered on December 27, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.