[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: shanky, Piyu, Resh  
Shell scripting in Linux
vedDate: Saturday, 2014-05-17, 12:14 PM | Message # 1
Private
Group: Users
Messages: 2
Awards: 0
Reputation: 8
Status: Offline
On behalf of a friend
 
From: Subhojit Ghosh
Posted At: Wednesday, June 26, 2013 4:29 PM
Subject: need shell script help

Hi Friends,
In the below shell script I don’t want to take the 1stparameter in consideration. i.e I want to skip the 1st parameter.
Please help me to do so…..

for i in $*

do
file= cat $i|wc -l;
echo $file;
done

Thanks and Regards,
Subhojit Ghosh
 
shankyDate: Tuesday, 2014-05-27, 12:28 PM | Message # 2
Lieutenant
Group: Administrators
Messages: 46
Awards: 0
Reputation: 104
Status: Offline
Hi Subhojit
You can use below script

for i in $*
do
#echo "$i";
if [[ $i = "ignore"  ]]; then
continue;
fi
file= cat $i | wc -l
echo -n "${file}"
done

Run like:    ./script.sh ignore file1 file2 file3

You need to the first parameteras a keyword which can be ignored.
Hope this can help
 
Thanks
Shankar Kumar Bhagat


s.k.bhagat
 
  • Page 1 of 1
  • 1
Search: