“Write a shell script (to run on the Bourne shell) that takes a file name as argument
Unix
- “Write a shell script (to run on the Bourne shell) that takes a file name as argument and then compresses and decompresses the file with each of the following programs: bzip2 gzip zip For each of the compressing programs, the script notes the size of the file before and after compression. Then, the script displays a table showing the compression program, uncompressed size, and compressed size. Before using a compressing program to manipulate the file, your script must verify that the file actually exists under the current directory and is readable. You would probably need to research the UNIX command named set. Your script for this task must be named compr.sh. Make sure your script is user-friendly and follows common sense.”
edit: an extra bit from the question i forgot to put in at the end “Your script for this task must be named compr.sh. Make sure your script is user-friendly and follows common sense. Here is a sample output (The $ is the shell prompt, and ff is the file name): $ compr.sh ff File: ff bzip2 174145 13976 gzip 174145 11746 zip 174145 11879 (Note: This output shows that, before compressing, the size of the file named ff is 174145 bytes. After compressing using bzip2, its size becomes 13976 bytes. After compressing using gzip, its size becomes 11746 bytes. After compressing using zip, its size becomes 11879 bytes. The table shows that, for file ff, the most efficient compressing program is gzip. Please note that the columns of the table must be left-aligned.)”