The script file should be called \"ds\" and should be invocable as ./ds from the
ID: 3621419 • Letter: T
Question
The script file should be called "ds" and should be invocable as./ds
from the command line. In your script you may use common Linux commands: make sure that your script runs fine on any Linux machine.
The script should list the disk storage occupied by each immediate subdirectory of
a given argument or the current directory (if no argument is given) with the subdirectory names sorted alphabetically.
Also, list the name of the subdirectory with the highest disk usage along with its storage size.
If more than one subdirectory has the same highest disk usage, list any one of those subdirectories. Include meaningful brief comments.
List of bash commands applicable for this script: cat, cut, du, echo, exit, for, head, if, ls, rm, sort, tail, wc
You may use bash variables as well as temporary files to hold intermediate results. Delete all temporary files at the end of the execution.
Here is an example of the script invocation:
$ ./ds
Disk space use (in KB) for each subdirectory:
4352840 ./Desktop
10296 ./Documents
92704 ./Downloads
4 ./Music
8 ./Pictures
4 ./Public
820 ./scripts
4 ./Templates
8 ./tmp
4 ./Videos
2568 ./ViGedit
The subdirectory with the maximum disk space use:
4352840 ./Desktop
$ ./ds scripts/
No subdirectory is found inside scripts/
$
--------------------------------------------------------------------------------