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

This is a UNIX shell Script question. When you run a program from the command li

ID: 3808986 • Letter: T

Question

This is a UNIX shell Script question.

When you run a program from the command line, the Linux system searches a series of folders looking for that le. Those folders are dened in the PATH environment variable. If you want to nd out just what executable les are available on your system for you to use, just scan all the folders in the PATH environment variable. That may take some time to do manually, but it’s a breeze working out a small shell script to do that.

Call your script lab4.2. To get you started, the rst step is to create a for-loop to iterate through the folders stored in the PATH environment variable. When you do that, don’t forget to set the IFS separator character:

PLEASE answer SPECIFICALLY in UNIX Shell Script. Do NOT answer in Java/programming language code or UNIX shell commands.

Explanation / Answer

# setting user defined directory

#!/bin/bash
sta_dir=${1:-`pwd`} # set to current directory or user supplied directory
echo "start_dir=$sta_dir"

for dire in "$sta_dir"/*/ ; do
echo "dir=$dire"
done

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