im writing a script that allows the user to create a backup of a file they choose by allowing them to input the file name. the file will then have backup followed by being date stamped at the end of it's name and saved on the home drive. but whenever i try to run it i get an error: cp: missing destination file operand after '_backup_2017_12_16'
here's my code:
title="my script 3"
prompt="Enter:"
options=("create a backup of a file")
echo "$title"
PS3="$prompt "
select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
esac
cp "$filename""${file}_backup_$(date +%Y_%m_%d)"
done
cp SOURCE DEST$REPLYvalues inside thecase...esacstatement. 2) You need to read the filename in from the user; currently, neither$filenamenor$filehas any value (and are they supposed to be different variables?). 3) You need a space between the arguments tocp.