Now, this is a strange problem, I have this kind of script:
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
RESOURCES_PATH="${CWD}/resources"
PROJECT_NAME="something"
DRUSH_ALIASES_EXAMPLE_PATH="${RESOURCES_PATH}/example.aliases.drushrc.php"
DRUSH_ALIASES_PATH="~/.drush/${PROJECT_NAME}.aliases.drushrc.php"
cp ${DRUSH_ALIASES_EXAMPLE_PATH} ${DRUSH_ALIASES_PATH}
echo "cp ${DRUSH_ALIASES_EXAMPLE_PATH} ${DRUSH_ALIASES_PATH}"
When I'm trying to run that kind of script, I'm getting error: "cp: Cannot create regular file "~/.drush/something.aliases.drushrc.php". There is no such file or directory"
But the funny thing is, that if I will copy the output of "echo" and paste in directly into terminal, the command will work just fine. I'm confused, any ideas what can be wrong with above script?
Best Answer
Try using
$HOME/.drush...
instead of~/.drush....
the"~"
does not seem to be expanded to your home directory.