as I'm pretty new to shell programming I'm completely lost with this error I get:
stat: illegal option -- -
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
This error occurs when I run the script on FreeBSD. It works just fine on CentOS.
This is the code I'm using
for i in `find "$1" -name "$2" -type f ! -name "$3" -print0 | xargs -0 stat --format="%s" | sort -n| awk {print}`; do
size_array[$j]=$i
((j=j+1))
What is basicaly does is to load size of all files into array. So I will be able to make median of all files sizes. So this should display file size in bytes.
stat --format="%s"
What syntax sould I use to get rid of this error?
If anyone could help me out I would be very grateful. Thanks