I am pretty much a noob when it comes to writing a shell script. I find myself with such a simple issue and I've tried googling and looking at other StackOverflow questions but to no avail. I still get the same error. I am working with Jenkins and running this command as a shell script.
I am trying to input a file path into another shell script as a variable. However, I kept getting the error that the file or directory doesn't exist. I realized that there was a space in one of the folders in the path. I have tried escaping it with double quotes, single quotes, and also formatting it based on the answers to this question.
My current command:
FILENAME=$(printf %q "//MyServer/Build Archive/Daily_Builds/DailyBuild_29627.zip")
$FILENAME
I get the following output:
printf %q '//MyServer/Build Archive/Daily_Builds/DailyBuild_29627.zip'
+ FILENAME='//MyServer/Build\ Archive/Daily_Builds/DailyBuild_29627.zip'
+ '//MyServer/Build\' Archive/Daily_Builds/DailyBuild_29627.zip
line 6: //MyServer/Build\: No such file or directory