Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Assignment

The example output in the links above show the results of a program run through a series of tests. The examples show what the PATH environment variable was set to for the test case, the command that was run, the expected results and the output of the program.

PATH   ==> /usr/bin:/usr/local/bin:/usr/bin/X11

RAN    ==> mar1.sh -a tar

RESULT ==> PASSED

EXPECTED RESULT ==> /usr/bin/tar

PROGRAM OUTPUT  ==> /usr/bin/tar

You script will should out put the results (the data after the ==> in the EXPECTED RESULT) section.

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.

• The search path should be based only on the user's PATH environment variable. You shall not use the Unix which command, the ksh whence (type) command, the locate command, or the bash type command.

• The code for the script shall not use the UNIX ls command to determine if the file is executable or if it exists.

• The script should find only the first occurrence of the "file". If the file is not found, the script the following

NOT FOUND

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

• If the first parameter is '-a', then the script should print all occurrences of the executable file in the user's path. Again if the file was not on the path, an error message should be displayed.

• The find command shall not be used.

• A project using temporary files will not be graded.

Note:

• The shell variable PATH defines the search path for the directory containing the command. Alternative directory names are separated by a colon (:). The current directory can be specified by two or more adjacent colons, or by a colon at the beginning or end of the path list.

• If the command name contains a / then the search path is not used, you just check if the command/file specified is executable and not a directory. Otherwise, each directory in the path is searched for an executable file.

usage: mywhich [-a] command ....

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>mywhichfooblar
fooblar not found

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

The PDF file (in the folder that says Assignment 1 example pdf) has a flow chart example of how to program Assignment 1.

Here is some psuedo code:

BEGIN 
    set FINDALL to false
    IF $1 equals -a THEN
        set FINDALL to TRUE
        dispose of $1
    END-IF
    FOR each Positional Parameter ($file) DO
        IF $file is a pathname THEN
            IF if $file is executable and not a directory THEN
                echo $file
            ELSE
                echo $file  is NOT Found
            END-IF
        ELSE
            set FOUND to false
            # Don't forget to handle the special cases of PATH
            FOR  P in PATH (: separated list) DO
                IF $P/$file is executable and not a directory THEN
                    set FOUND to true
                    echo $P/$file
                    IF FINDALL is FALSE THEN
                        BREAK FROMTHE for  LOOP
                    END-IF
                ELSE
                END-IF
                IF FOUND is FALSE THEN
                    echo $file is NOT FOUND
                END-IF
            END-FOR
        END-IF
    END-FOR
END

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M92504070
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Operating System

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Briefly describe the following concepts and indicate how they are related in the context ...

Question what do you see as the major differences between

Question : What do you see as the major differences between UNIX/Linux and other operating systems, such as Windows and Mac OS X? The response must be typed, single spaced, must be in times new roman font (size 12) and m ...

Show all stepssuppose that the following processes arrive

Show all steps Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. in answering the questions, use non-preemptive scheduling and base all dec ...

Question topic computerized operating systems os are almost

Question: Topic: Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use our phone or tablet. Find articles that describes the diff ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

Question note apa format 250 words and three reference

Question: Note: APA format 250 words and three reference without plagarism Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use ...

Taskyour job in this assignment is to create two virtual

Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these VM's is to offer services to a user base. The ...

Question you are a security administrator responsible for

Question: You are a security administrator responsible for providing secure configuration requirements for new laptop deployments. After reading Module 2 of Certified Secure Computer User v2exercises, apply the configura ...

Discussion question this research assignment will give

Discussion Question : This research assignment will give further information on the nature and workings of multi-tasking and multi-processing operating systems. All information reported in this assignment is to be in the ...

Question 1answer the following questions 10 marks a

Question 1 Answer the following questions: 10 marks a. Consider the following page reference string: 3, 1, 4, 1, 2, 3, 5, 3, 2, 1, 2,5, 4, 3, 5, 2, 4,2, 5,3 Using the above page reference string display the contents of t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As