Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # fns
- if [ -z "$1" ]; then
- echo 'Usage: fns string1 string2 ... [-v stringA stringB ...]'
- echo
- echo 'Finds files under CWD whose pathname contains all of the strings 1, 2, etc,'
- echo 'and none of the (optional) strings A, B, etc. Case insensitive.'
- exit
- fi
- function printfct
- {
- while read fqname; do
- size=$(stat -c %s "$fqname")
- size2="$(printf "%'13d" $size)"
- echo "$size2" $fqname
- done
- }
- cmd="find -L . -print | grep -i $1"
- vflag=false
- while [ -n "$2" ]; do
- if [ "$2" = "-v" ]; then
- vflag=true
- else
- if $vflag; then
- cmd=$cmd" | grep -iv $2"
- else
- cmd=$cmd" | grep -i $2"
- fi
- fi
- shift
- done
- eval $cmd | sort | printfct |o
- exit
Add Comment
Please, Sign In to add comment