Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grep da * 2
- # check command line arguments
- if [ $# -eq 0 ]
- then
- echo "wrong number of command line arguments"
- echo "Usage: `basename $0` -?"
- echo "
- or"
- echo "
- `basename $0` -d <file_to_be_deleted>"
- echo "
- or"
- echo "
- `basename $0` -f <text> <number_of_lines> <outfile>"
- exit
- fi
- if [ $# -eq 1 ]
- then
- if [ "$1" != "-?" ]
- then
- echo "incorrect command line argument: $1"
- fi
- echo "Usage: `basename $0` -?"
- echo "
- or"
- echo "
- `basename $0` -d <file_to_be_deleted>"
- echo "
- or"
- echo "
- `basename $0` -f <text> <number_of_lines> <outfile>"
- exit
- fi
- if [ $# -eq 2 ]
- then
- if [ "$1" == "-d" ]
- then
- echo "removing file $2"
- rm $2
- exit
- else
- echo "incorrect command line argument: $1"
- echo "Usage: `basename $0` -?"
- echo "
- or"
- echo "
- `basename $0` -d <file_to_be_deleted>"
- echo "
- or"
- echo "
- `basename $0` -f <text> <number_of_lines> <outfile>"
- exit
- fi
- fi
- if [ $# -eq 3 ]
- then
- echo "wrong number of command line arguments"
- echo "Usage: `basename $0` -?"
- echo
- echo
- echo
- echo
- exit
- if [ $# -eq 4 ]
- then
- if [ "$1" != "-f" ]
- then
- echo "incorrect command line argument: $1"
- echo "Usage: `basename $0` -?"
- echo "
- or"
- echo "
- `basename $0` -d <file_to_be_deleted>"
- echo "
- or"
- echo "
- `basename $0` -f <text> <number_of_lines> <outfile>"
- exit
- fi
- fi
- if [ $# -gt 4 ]
- then
- echo "wrong number of command line arguments"
- echo "Usage: `basename $0` -?"
- echo "
- or"
- echo "
- `basename $0` -d <file_to_be_deleted>"
- echo "
- or"
- echo "
- `basename $0` -f <text> <number_of_lines> <outfile>"
- exit
- fi
- # so the command line arguments are OK
- # redirect standard output to $4
- >$4
- # loop through and create the lines and ad them to $4
- for ((i=1; i<=$3; i++))
- do
- echo "$2**$i">>$4
- done
- # show the created file
- cat $4
Add Comment
Please, Sign In to add comment