I'd like to store my path in variable in order to use with mv
command.
WEBSITEPATH="/var/www/gestiaweb/mywebsitefolder/"
mv "$WEBSITEPATHcms/configs/database.json" $WEBSITEPATH
Error : WEBSITEPATHcms
is interpreted as a folder.
In general, it's a good idea to wrap your shell variables with {..}
. So, do:
mv "${WEBSITEPATH}cms/configs/database.json" "${WEBSITEPATH}"
instead. You'll note I also quoted the second use of the variable. This is generally a good idea also.
I find that the Google style guide for shell scripts is pretty good advice: https://google.github.io/styleguide/shellguide.html