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

I am new to Unix and looking for some help for my class assignment. The required

ID: 3549588 • Letter: I

Question

I am new to Unix and looking for some help for my class assignment. The required assignment is as follows:

Write a shell script to locate executable files. This script takes a list of file names from the command line and determines which would be executed had these names been given as commands.

<command> NOT FOUND

<command> would be replaced by the name of the "file" you didn't find.

Examples: The locations of these programs may vary on different systems and the users PATH environment variable.

prompt> mywhich ls
/bin/ls

prompt> mywhich -a cc
/bin/cc
/usr/ucb/cc

prompt> mywhich ./mywhich
./mywhich

prompt> mywhich /bin/ls
/bin/ls

prompt> mywhich fooblar
fooblar not found

prompt> mywhich ksh sh csh bash
/usr/bin/ksh
/bin/sh
/bin/csh
/usr/local/bin/bash

Explanation / Answer

We are now familiar with the shell and a large number of commands.

In this lecture, we will discuss shell programming using bash. The main goal is to be able to write your own scripts. But what are scripts? And what are they useful for? We will answer these questions.

We plan to learn the following from today