5 pts.
 Unix Shell Scripting
Hi,    Its about writing 2 command line argument.First argument i have created a file and put some text to it before writing the script. But i got stuck with second argument its an integer.The script should echo to the standard out put - the message"FILE IS SHORTER". If the number lines in the file named in the first argument is less than the integer the value of second argument should show echo to the standard"FILE IS NOT SHORTER".       can anyone help me with this..

Software/Hardware used:
UBUNTO
ASKED: October 7, 2010  11:55 PM
UPDATED: October 8, 2010  3:43 PM

Answer Wiki:
Roshan737, This should be a good start: #!/bin/bash if [ $# -eq 2 ] then LINES=$1 INTEGER=$2 else echo "Usage: $0 file integer" exit fi if [ $(wc -l $LINES) -lt "$INTEGER" ] then echo "FILE IS SHORTER" else echo "FILE IS NOT SHORTER" fi
Last Wiki Answer Submitted:  October 8, 2010  3:43 pm  by  Jgiacalone   120 pts.
All Answer Wiki Contributors:  Jgiacalone   120 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Can you post your current script ?

 63,535 pts.