1

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.

1 Answer 1

4

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

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.