Problem 1: Write a Bash script that takes the name of a file or directory as an argument, 1. reports if it is a directory or a file, and if the user has read, write and execute permission on the file or directory, and 2. if it is a file, reports the size of the file and the category of the file based on its size. If the file size is greater than 1MB (1048576B), the file is a large file; if the file size is less than or equal to 1MB (1048576B) and the file size is greater than 100KB (10240OB), the file is a medium file; otherwise, it is a small file. Use a sequence of if statements on the file name or file size to determine the information. To get the file size, use command du -b and command cut. Read their manual for how to use them.

LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
5th Edition
ISBN:9781337569798
Author:ECKERT
Publisher:ECKERT
Chapter7: Working With The Bash Shell
Section: Chapter Questions
Problem 5DE
icon
Related questions
Question
Problem 1:
Write a Bash script that takes the name of a file or directory as an argument,
1. reports if it is a directory or a file, and if the user has read, write and execute permission on
the file or directory, and
2. if it is a file, reports the size of the file and the category of the file based on its size. If the file
size is greater than 1MB (1048576B), the file is a large file; if the file size is less than or equal to
1MB (1048576B) and the file size is greater than 100KB (10240OB), the file is a medium file;
otherwise, it is a small file.
Use a sequence of if statements on the file name or file size to determine the information.
To get the file size, use command du -b and command cut. Read their manual for how to use
them.
Transcribed Image Text:Problem 1: Write a Bash script that takes the name of a file or directory as an argument, 1. reports if it is a directory or a file, and if the user has read, write and execute permission on the file or directory, and 2. if it is a file, reports the size of the file and the category of the file based on its size. If the file size is greater than 1MB (1048576B), the file is a large file; if the file size is less than or equal to 1MB (1048576B) and the file size is greater than 100KB (10240OB), the file is a medium file; otherwise, it is a small file. Use a sequence of if statements on the file name or file size to determine the information. To get the file size, use command du -b and command cut. Read their manual for how to use them.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning