Register
It is currently Sat Jul 26, 2014 3:07 am

[bash] script with used of getopts


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Sat Apr 09, 2011 1:59 am   

Joined: Sat Apr 09, 2011 1:49 am
Posts: 1
hi i m a newbe of bash and i dont know very well getopts..
i need to write a script with parametr
./count [ -i start] [ -e end ] log1 ... logN

if i cal ./count file1....file n the script count the total lines of file 1 ...filen
if i cal ./count -i hello file1...filen the script count the total lines that starts with hello
./count -e byby file1 file n the script count the total lines that ends with byby
./count -i hello -e byby file1...file the script cont the total lines that starts with hello and ends with byby
the order is irrivelevant( only rules is that the name of file is after the option of scripts)
ex: ./count -i hello -e byby prova.txt rul.txt is the equivalent of --> ./count -e byby -i hello prova.txt rul.txt ...
please help me i think that i have to use getopts but i dont know its, if some one do this script i study its to understand getopts


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP