I'm having issues combining two strings in bash on Linux. My end goal is simply to add a / to an existing path I have stored as a variable. Essentially I just want the path to lead into the folder instead of just to the folder itself.
The file path is fetched from an environment variable and so far everything I have tried to combine the file path with any form of string has simply failed.
At first, I assumed that it was an error caused by the / being seen as some special character so I've been testing with just normal strings but I haven't been able to make that work either.
Here's my test code:
filename=$NEMO_SCRIPT_SELECTED_FILE_PATHS
stringtest=boo
mytest="$filename$stringtest"
zenity --info --text=$mytest
I have tried also tried:
filename+="boo"
filename+="$stringtest"
filename="${filename} test"
filename="${filename} ${stringtest}"
mytest=$filename$stringtest
filename=$(printf "%s boop" "$filename")
No matter what I seem to do I only get the file path as an output. The only time I have had any success was when adding the file path to another string instead of adding a string to the file path.
Thanks for the read
EDIT: As suggested by @thatotherguy below, I was missing "" around my variable mytest in my zenity command. Adding those solved it. Thanks