Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Linux, write a bash script named dlist that takes one argument, either a d, o

ID: 3682567 • Letter: I

Question

In Linux, write a bash script named dlist that takes one argument, either a d, or an x, or an nx. If no argument or more than one argument is given, then print an error message, such as "incorrect number of arguments". If the argument is 'd', then dlist lists all of the directories within the current directory. If the argument is 'x' then dlist lists all of the ordinary, executable file (not directory). If the argument is 'nx' then dlist lists all of the ordinary, non-executable files in the current directory.

Explanation / Answer

#!/bin/bash
echo enter input who,cal,ls,ps,pwd,bash
read inpt
case "$inpt" in #using case to execute statements

who) who
;;
cal) cal
;;
ls) ls
;;
ps) ps
;;
pwd) pwd
;;
bash) bash
;;
*) echo "Invalid"
;;
esac

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote