I am using 'vifm --remote' in a bash script. Here is my bash script:
read -e -p "Enter folder name: " dirName
vifm --server-name vifm --remote +"goto \"$dirName\""
This creates new folder for inputs even if they have space, single quotes and/or double quotes. However, I couldn't manage to get the last line (vifm --remote) to work if the input has double quote. How can I escape double quotes in the input arguments that are used in vifm --remote command?
You can try using printf:
vifm --server-name vifm --remote +"goto $(printf %q "$dirName")"
Not sure if it will work in all cases though.
YES, this works, thank you!
This works great for folders, but it doesn't work for files even if they don't have any special characters. Do you have any suggestions?
Never-mind, the issue was becuase of the crash I reported in my other post. I killed vifm and tmux and now is all good. Thank you