Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- for i in $*; #iterate through command args
- do
- if [ $i = '-c' ] || [ $i = 'count' ];
- then
- shift
- i=$1
- lineCount=$i
- shift
- elif [ $i = '-p' ] || [ $i = '-permissions' ];
- then
- shift
- i=$i
- permissions=$i
- shift
- fi
- done
- if [ -d '$@' ]; #Check if directory is valid
- then
- filePath=$i
- else
- echo $i is not a valid directory
- exit 1
- fi
- if [[ $permissions = '' ]];
- then
- permissions='-r'
- fi
- if [[ $filePath = '' ]];
- then
- permissions='.'
- fi
- if [[ $lineCount = '' ]];
- then
- lineCount=
- echo $permissions
- echo $lineCount
- echo $filePath
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement