I'm using a bash shell script to delete certain files in directory using the below script
#!/bin/bash path=$1 for filename in $path/*; do if [ -d "$filename" ]; then echo $filename rm $filename/*statssys* fi done
In other words, it is looping one through all directories one level deep inside my specified path and removing any files that have
statssys in the name. The problem is that the file paths retrieved in
$filename contain numerical endings like
file_path. The square brackets have to be escaped before the
rm command works which I do not know how to do as they are hidden inside the $filename variable.
Any help appreciated.
"$filename". For example,