I am a new Ubuntu Linux user and PORTEUS and I am trying to translate my old batches into bash. Therefore, I’ve a question about the right use of find with arguments because I’v many scripts with this problem. The following works fine:
find /home/abc/ -name '* *' | while read fname . . ."
But how to use it with arguments?
path=/home/abc/
extension=jpg
find $path -name '*.$extension' | while read fname . . .
The above is not working for me. I’ve experimented with quotes, double quotes but I can’ find the right way.
The same problem do I have with:
num=0
for i in /home/abc/*
do
mv "$i" "${i%.*}$(printf '%09d' $num).${i#*.}"
((num++));
done
When replace the path with $path it doesn’t not work.I need a solution for every file () and for extension (.ext).
Does anyone has an idea?
Thanks
Peter