The last step comes with no ready-made commands: a script that copes with a name with a space and answers a wrong call.
In ~/args-lab there is save.sh: a shebang and the contract in comments, no body. Finish it in nano or vim. Test each case yourself: with a file, with a directory, with no argument — and right after each run, echo $?. The exercise check will also run the script on paths the task does not mention.
Finish the copy script
In ~/args-lab, finish save.sh to the contract in its comments. ./save.sh FILE puts a copy of a regular file into the backup directory under the same name and exits with code 0. With no argument: the line Usage: save.sh FILE on stderr and code 2. If the argument is not a regular file: a message on stderr and code 1.
Goals · 0 of 3
- Save a copy of a file with a space in its name not done yet
- Answer a call with no argument as the contract says not done yet
- Refuse when the argument is not a regular file not done yet