I am trying to rename all files in a folder replacing underscores with spaces.
i.e. this_is_a_test --> this is a test
but somehow I'm messing up the quoting
> for file in * ; do echo mv -v $file $(echo $file | sed 's/_/\\ /g') ; done mv -v this_is_a_test this\ is\ a\ test
that looks OK, but if I remove the 'echo' mv complains as if the backslashes were removed
> for file in * ; do mv -v $file $(echo $file | sed 's/_/\\ /g') ; done mv: target ‘test’ is not a directory
Can someone point out the error of my ways?