Assignment 1 Instructions
User Manual:
Open the PDF directly: View PDF
.
Page Count: 2
| Download | |
| Open PDF In Browser | View PDF |
Assignment 1 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. • • • • • • • • • Please refer the Syllabus for the Assigment / Project Requirements and Guidelines 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 followingNOT 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 depending on the system and the value of the 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 If you look at the other attached files in the programing assignments, 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 ONLY out put the results which would be the data after the ==> in the EXPECTED RESULT section.
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : Yes Author : Richards, Michael Comments : Company : Create Date : 2017:11:02 12:51:12-04:00 Modify Date : 2017:11:02 12:52:17-04:00 Source Modified : D:20171102165058 Subject : Language : EN-US Tagged PDF : Yes XMP Toolkit : Adobe XMP Core 5.6-c015 84.159810, 2016/09/10-02:41:30 Metadata Date : 2017:11:02 12:52:17-04:00 Creator Tool : Acrobat PDFMaker 17 for Word Document ID : uuid:5f07c54a-6791-4b5c-85ff-7f141b875374 Instance ID : uuid:7d63ce85-e6f5-4b78-9789-28654de62234 Format : application/pdf Title : Description : Creator : Richards, Michael Producer : Adobe PDF Library 15.0 Keywords : Page Layout : OneColumn Page Count : 2EXIF Metadata provided by EXIF.tools