Re: realpath quoting
Am 03.05.2024 um 00:59 schrieb jeremy ardley:
> I have a need to get the full path of a file that has spaces in its
> name to use as a program argument
>
> e.g.
>
> jeremy@client:~$ ls -l name\ with\ spaces
> -rw-r--r-- 1 jeremy jeremy 0 May 3 06:51 'name with spaces'
> jeremy@client:~$ realpath name\ with\ spaces
> /home/jeremy/name with spaces
>
>
> The spaces without quotes cause problems with subsequent processing.
>
> Can realpath or other utility return a quoted pathname?
>
>
Do you mean something along those lines:
> $ touch '/mnt/tmp/gibt es nicht'
> $ realpath -mz "../ln/tmpRAM/gibt es nicht" | xargs -0 ls --quoting-style=escape
> /mnt/tmp/gibt\ es\ nicht
?
Reply to: