Artificial intelligent assistant

Getting error while passing spaced folder **Code: -** filesDirName="/C/Users/OM\\ SAI\\ RAM/HelloWorldSagar" echo ${filesDirName} echo "cd ${filesDirName}" cd ${filesDirName} **_bash output: -_** $ ./files.sh /C/Users/OM\ SAI\ RAM/HelloWorldSagar cd /C/Users/OM\ SAI\ RAM/HelloWorldSagar ./files.sh: line 4: cd: too many arguments

Like this:


# No backslash before space needed, as the entire sting is quoted with "
filesDirName="/C/Users/OM SAI RAM/HelloWorldSagar"
# echo allows multiple parameter, so it worked by chance
# You should quote it anyway
echo "${filesDirName}"
echo "cd ${filesDirName}"
# quote the parameter
cd "${filesDirName}"


Rule of thumb: If in doubt, quote the variable.

BTW: Indent your code by 4 spaces, so it is displayed as a code block

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a01c5d303e6fba601a97c2b59ac648fc