0

I am writing a small script to symbolically link configuration files from my dotfiles directory to another one. I do not have control over the file names and unfortunately one of them is causing me a lot of trouble. The simplest reproducible case I have is as follows:

export file_name='My Configuration Text.theme'

readlink -f $file_name

Which predictably returns:

/home/me/folder/My
/home/me/folder/Configuration
/home/me/folder/Text.theme

I need this to not be split. I have also tried

readlink -f $(printf "%q " $file_name)

And it does not seem to fix the problem. Is there a solution to this or am I better off rewriting my linking script in something more robust like Python?

CL40
  • 111
  • See the questions marked as duplicates. You need to double quote $file_name in the call to readlink. There is no need to export the variable (at least not in relation to your issue or the resolution of it). – Kusalananda May 22 '21 at 17:56
  • Got it, sorry for the dupe. Thank you! – CL40 May 22 '21 at 18:02

0 Answers0