0
I am making a script where I want to capture a path to the name of a user file and then use it, plus the extension, to redirect the output of a command.
example:
Insert path: ~/Videos/file
I do it using "read-and path", and then rerouting the output like this:
foo > ${path}.abc
But if that path has spaces, for example, ~/Área\ de\ Trabalho
, go wrong.
How to capture the path so that it works even for those who have blanks?
Thanks in advance.
shell expands manifolds between quotation marks. Try:
foo > ~/"$path".abc
– JJoao
Using the quotes works the path with spaces, but the use of ~ for the home if inserted by the user is lost.
– Hugo Farias
see if my answer works...
– JJoao