Exercises
1. Modify the copy program developed in Program 16.6 so that it can accept more than one source file to be copied into a directory, like the standard UNIX cp command. So, the command
$ copy copy1.m file1.m file2.m progs
should copy the three files copy1.m, file1.m, and file2.m into the directory progs. Be sure that when more than one source file is specified, the last argument is, in fact, an existing directory.
2. Write a command-line tool called myfind that takes two arguments. The first is a starting directory to begin the search, and the second is a filename to locate. So, the command line
$ myfind /Users proposal.doc/Users/stevekochan/MyDocuments/proposals/proposal.doc$
begins searching the file system from /Users to locate the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access