Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links

Posted By: Ararinda Schmidt     Category: Unix / Linux / Ubuntu     Views: 7269

Write a Shell Script to create a Menu Driven program:
1) Hard Link.
2) Soft Link.
3) Counting each of the links for a specific link.
4) Display the soft-links for the given files.

Code for Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links in Unix / Linux / Ubuntu

echo "1.for creating the hard link "
echo "2.for creating the soft link"
echo "3.counting the links"
echo "enter your choice"
read expr
case $expr in
1)      echo "for creating the hard link"
        echo "enter the name of file to create hard link"
        read f1
        echo "enter to create the child for hard link"
        read f2
        ln $f1 $f2
        ls -l $f2
        ;;
2)      echo "for creating the soft link"
        echo "enter the name of file for creating soft link"
        read f1
        echo "enter to create the child for hard link"
        read f2
        ln -s $f1 $f2
        ls -l $f2
        ;;
3)      echo "counting the echo of the link "
               read f1
               #ls -l $f1 | tee l5
               awk -F " "'{ print $2 }' l5
               ;;
  esac
echo  "completed"











OUTPUT
***********
 [04mca58@LINTEL 04mca58]$ sh link.sh
1.for creating the hard link
2.for creating the soft link
3.counting the links
enter your choice
1
for creating the hard link
enter the name of file to create hard link
a
enter to create the child for hard link
er
-rw-r--r--    7 04mca13  users          10 Dec 12 13:25 er
completed

[04mca58@LINTEL 04mca58]$ sh link.sh
1.for creating the hard link
2.for creating the soft link
3.counting the links
enter your choice
2
for creating the soft link
enter the name of file for creating soft link
a
enter to create the child for hard link
e
lrwxrwxrwx    1 04mca13  users           1 Dec 12 14:20 e -> a

[04mca58@LINTEL 04mca58]$ sh link.sh
1.for creating the hard link
2.for creating the soft link
3.counting the links
enter your choice
3
counting the echo of the link
a
5
  
Share: 



Ararinda Schmidt
Ararinda Schmidt author of Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!