Modify shar to include in the archive the character count for each file and commands to compare the count of each extracted file against the count of the original file. If a discrepancy occurs, output an appropriate error message.

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"

chars=$( wc -c < $subfile )
echo "if [ \$(wc -c < $subfile) -ne $chars ] ; then"
echo " echo error: file $subfile should have $chars characters"
echo "fi"
done
else
echo "echo Extracting $file"
echo "cat >$file <<\THE-END-OF-DATA"
cat $file
echo "THE-END-OF-DATA"

chars=$( wc -c < $file )
echo "if [ \$(wc -c < $file) -ne $chars ] ; then"
echo " echo error: file $file should have $chars characters"
echo "fi"

fi
done

Computer Science & Information Technology

You might also like to view...

Pleading paper contains a(n) ____________________ ruling from top to bottom at the left margin.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A slice is always rectangular unless you create it using an elliptical marquis.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which of the following need to be taken into consideration during the system security planning process?

A. how users are authenticated B. the categories of users of the system C. what access the system has to information stored on other hosts D. all of the above

Computer Science & Information Technology

Describe what entity types represent in an ER model and provide examples of entities with a physical or conceptual existence.

What will be an ideal response?

Computer Science & Information Technology