Modify the shar program presented in this chapter to handle directories: If the user specifies a directory instead of a file, it will archive every file within that directory and create the directory as needed when the archive is unpacked.
What will be an ideal response?
echo "#"
echo "# To restore, type sh archive"
echo "#"
for file
do
if [ -d "$file" ]
then
echo "if [ ! -d $file ] ; then"
echo " echo Making directory $file"
echo " mkdir $file"
echo "fi"
for subfile in $file/*
do
echo "echo Extracting file $subfile"
echo "cat > $subfile <<\THE-END-OF-DATA"
cat $subfile
echo "THE-END-OF-DATA"
done
else
echo "echo Extracting $file"
echo "cat >$file <<\THE-END-OF-DATA"
cat $file
echo "THE-END-OF-DATA"
fi
done
You might also like to view...
Lossless compression, used by the JPEG format, retains all the original data in the image
Answer the following statement true (T) or false (F)
(Printing Dates in Various Formats) Dates are printed in several common formats. Write a script that reads a date from an HTML form and creates a Date object in which to store that date. Then, use the various methods of the Date object that convert Dates into strings to display the date in several formats.
What will be an ideal response?
The argument you pass to the strlen() function is a literal string or string variable whose ____________________ you want to count.
Fill in the blank(s) with the appropriate word(s).
The ________ function is the most commonly used logical function in Excel.
Fill in the blank(s) with the appropriate word(s).