Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm storing a long folder path in my code as a variable and it has a space in it. The space is being treated as a new line or end of statement. This is causing and error in my code.

Unfortunately I only share the one line of code that is giving me the problem. Hopefully that is enough to diagnose the issue.

When I run my code, I get the following error:
./fast_sparta.sh: line 29: "/Users/meme/Documents/Automation: No such file or directory

What I have tried:

THEPATH="/Users/meme/Documents/Automation projects/ST/rumble-687.94957ca6d3-macosx"
Posted
Updated 2-Dec-21 18:49pm
Comments
Peter_in_2780 2-Dec-21 17:41pm    
Put "linux file path spaces" into your fave search engine and choose your poison from the results. There are many ways...
wifinut 2-Dec-21 17:54pm    
Thanks. As it turned out, the problem line was not in my variable declaration, but rather how I referenced it. Problem solved!
Peter_in_2780 2-Dec-21 19:11pm    
Great! Just remember the difference between single and double quotes!
My aide-memoire is that double quotes are wider, so they do the expansion of $ ` \

1 solution

Answered only to remove from unanswered queue - solved by OP.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900