How to run shell script

Solved/Closed
Basumuttur - Jan 16, 2010 at 06:32 AM
jipicy Posts 40805 Registration date Wednesday August 27, 2003 Status Moderator Last seen August 10, 2020 - Jan 17, 2010 at 10:33 AM
Hello,

I am writing simple shell script in Ubuntu linux.

$ vi sayH
echo "Your first name please:"
read fname
echo "Hello $fname, Lets be friend!"

How to execute and Run in linux?? please usuggest me.

Regards,
Basu

1 reply

jipicy Posts 40805 Registration date Wednesday August 27, 2003 Status Moderator Last seen August 10, 2020 17
Jan 17, 2010 at 10:33 AM
Hi,

First, append "#! /bin/bash" in top of file:

#! /bin/bash

echo "Your first name please:"
read fname
echo "Hello $fname, Lets be friend!" 

Then:

chmod u+x sayH <Enter>
./sayH <Enter>

Enjoy.
0