!! This question is not about SHELL, it's about BASH, can't change the faulty tag !!
I've got a code that removes the spaces in directories and filenames (and inserts a dot);
find $jdir -depth -name "* *" -execdir rename 's/ /./g' "{}" \;
let's say $jdir = "test files are here"
This code don't rename the $jdir.
and I can't set it to the parent directory, because then it would rename a lot of other directories.
How do I get it to rename the $jdir?
(testing bug? in forum, disregard this line) I can't change the tags, a bug in the forum?
bash
. Your code works for me, if only$jdir
is properly double-quoted. – Kamil Maciorowski Aug 13 '20 at 18:42test.files.are.here
. Ubuntu 18.04.4 LTS;find
(GNU findutils) 4.7.0-git. – Kamil Maciorowski Aug 13 '20 at 18:53jdir=${jdir// /.}
would replace all spaces by dots in the value of the variablejdir
. – Kusalananda Aug 13 '20 at 19:10