Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo 'Enter a number: '
- read num1
- echo 'Enter in a bigger number: '
- read num2
- if [ $num1 -gt $num2 ]
- then
- echo "ERROR"
- exit 2
- else
- echo "The ordinary files in the directory $1 that are between $num1 bytes and $num2 bytes in size are the following:"
- echo
- for f in `ls $1`
- do
- if [ -f $f ] ; then
- size=$(wc -c "$f" | cut -f 1 -d ' ')
- if [[ $size -ge $num1 ]] && [[ $size -le $num2 ]] ; then
- echo "$f is $size bytes"
- fi
- fi
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement