Code.GeekInterview.com
 
Code Samples UNIX
 

File Retriever


Code ResourceAuthor: christia  

Difficulty Level:

Published: 10th Jun 2007   Read: 3368 times  

Filed in: UNIX
Add Comment


 

 

Sponsored Links


 

 

This shell script is written in Bourne Shell. The Shell Script is used to retrieve the xth file from a directory. To execute the Bourne-shell script named as filename.sh in your UNIX operating system in Bourne shell prompt type sh filename.sh and press enter.

 


Sample Code
  1.  
  2.  #The Shell Script is used to retrieve the xth file from a directory
  3. if($# -ne 1)
  4. then echo "Usage is:$0<fileno>"
  5. exit 1
  6. fi
  7. num=$1
  8. set *
  9. shift 'expr $num-1'
  10. eval echo "$[num]th file is $1"
  11.  
Copyright GeekInterview.com


Next Article: Mail Checker


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    



Popular Coders

# Coder NameHits
1. mano.mithun5732
2. christia3369
3. GregMark2777

Active Coders

# Coder NameCodes
1. GregMark1
2. christia1
3. mano.mithun1

Refined Tags