I'm a newbie to shell programming and have no idea how to solve this problem.
I just downloaded a file from the Internet to the default directory ~/Downloads
. I want to move that file to another directory, ~/Documents
.
Since I don't know the exact name of the downloaded file, I think I can use the following command to achieve my goal:
ls -t ~/Downloads | head -1 | mv [source] [destination]
How can I specify which formal parameter to replace. In my case, I want to omit [source]
and fill in the [destination]
parameter as ~/Documents
myself.
Best Answer
You want
xargs
.