Joined: Sat Apr 09, 2011 1:49 am
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