The programs here are potentially dangerous! Be careful to test them
in a mostly empty directory to make it difficult to accidentally
delete something useful.
See Section A.12, "Answers to Chapter 13 Exercises" for answers to the following
 Write a program that works like rm, deleting
any files named on the command line. (You don't need to handle
any of the options of rm.)
 Write a program that works like mv,
renaming the first command-line argument to the second command-line
argument. (You don't need to handle any of the options of
mv or additional arguments.) Remember to allow
for the destination to be a directory; if it is, use the same
original basename in the new directory.
 If your operating system supports it, write a program that works
like ln, making a hard link from the first
command-line argument to the second. (You don't need to handle
options of ln or more arguments.) If your system
doesn't have hard links, just print out a message telling what
operation you would perform if it were available. Hint: This program
has something in common with the previous one -- recognizing that
could save you time in coding.
 If your operating system supports it, fix up the program from the
previous exercise to allow an optional -s switch
before the other arguments to indicate that you want to make a soft
link instead of a hard link. (Even if you don't have hard
links, see whether you can at least make soft links with this
 If your operating system supports it, write a program to find any
symbolic links in the current directory and print out their values
(like ls -l would: name ->
Copyright © 2002 O'Reilly & Associates. All rights reserved.