A shell script file should conventionally have an extension .sh
The first line of your script file should be #!/bin/bash, this line actually tells
the OS that the script is a bash script.
A simple script file example
open a script file say file1.sh with vi. vi file1.sh
#!/bin/bash
echo "Hello World, this is what I got in my home directory
ls /home/subhroneel
save the file and quit vi.
set executable permission to file1.sh
$chmod u+x file1.sh
run the script just as written below
$./file1.sh
output is:
Hello World
Listing of /home/subhroneel directory
Music Video Ebooks
The first line of your script file should be #!/bin/bash, this line actually tells
the OS that the script is a bash script.
A simple script file example
open a script file say file1.sh with vi. vi file1.sh
#!/bin/bash
echo "Hello World, this is what I got in my home directory
ls /home/subhroneel
save the file and quit vi.
set executable permission to file1.sh
$chmod u+x file1.sh
run the script just as written below
$./file1.sh
output is:
Hello World
Listing of /home/subhroneel directory
Music Video Ebooks
No comments:
Post a Comment