Here is a simple interactive shell script to display concatenation of two strings entered by the user and display the length the resultant string. Vim Script_Name.sh :i #!bin/bash echo -n "Enter the file path : " #Display user the message to enter file path. read file_path #Input the path. echo "The fourth and fifth line of file are as follows:" cat $file_path | head -5 | tail -2 #Display fourth and fifth line. :wq The above script can be executed directly as follows: # bash Script_Name.sh OR # sh Script_Name.sh The script can also be executed by giving execute permission as follows: # chmod +x Script_Name # ./Script_Name
0 comments:
Post a Comment