I am working on a bash script to copy configuration files to their appropriate directories. I would like to output the name of the file that I have copied to the user. Here is what I have so far:
CONFIG_DIR="/home/stackoverflow/app/configs"
CONFIG_FILE="*.config"
cp $CONFIG_FILE $CONFIG_DIR
echo "$CONFIG_FILE was copied to $CONFIG_DIR"
The output I get from this is:
*.config was copied to /home/stackoverflow/app/configs
Let’s assume that stackoverflow.config is the only .config file present in the directory where the script is running. I would like it to say:
stackoverflow.config was copied to /home/stackoverflow/app/configs
Either add -v to copy and have it print all the file names (one name per line) or change the echo to
i.e. remove the double quotes (they are not necessary in this example).