Here’s a question for bash aficionados out there:
I need to “normalize” the values of a variable that contains file paths: Some of these file paths contain blank spaces (go figure!). After normalization, I need to delete all files at each address. It sounds like a very simple question, yet I’ve struggled with it for most part of today, to no avail. Here’s the best I have, and it doesn’t work:
location=$(find /home/"$user"/.config/google-chrome -type d -name "GPUCache")
# readarray -d '' location < <(find /home/"$user"/.config/google-chrome -type d -name "GPUCache" -print0)
path=$(echo "$location" | sed 's/ /\\ /')
rm "$path"/*
Questions:
- Can this be done w/o appeal to
sed
? Is there something simpler that cleans up the path? - Why does the
rm
line not work???