How do I make this script search through all users' home folders and then rm -f
the files matching EXT? Right now it's only deleting the files matching EXT in the current folder where I am executing the script.
#!/bin/bash
EXT=jpg
for i in *; do
if [ "${i}" != "${i%.${EXT}}" ];then
echo "I do something with the file $i"
rm -f $i
fi
done
username
may not have spaces, but/ho me/
(or its substitute) might. – Jeff Schaller Jan 15 '18 at 21:25