I have a shell script, that should move the most recently downloaded file to the current folder
#!/bin/zsh
lastfile=$(ls -t ~/Downloads | head -n 1)
mv "~/Downloads/${lastfile}" .
However, say the most recently dowloaded file in the Downloads folder is called test.png then running the script gives me the error
mv: rename ~/Downloads/test.png to ./test.png: No such file or directory
Anyone know why that is happening?