I'm having trouble trying to write a simple bash function that will move a file to a designated folder. The code I have written is as follows:
mv_file() {
DESTINATION_FOLDER="~/Whatever"
mv $1 $DESTINATION_FOLDER
}
The issue is however that $1
often contains escaped characters such as ~/\[Bracketed\]File
which when passed to $1
no longer contains the \
character and ends up looking for ~/[Bracketed]File
which isn't a valid file/path. I've gone through the other questions on this topic yet I don't think the solutions pertain to this problem. Any suggestions?