[Solved] Lab 9. Write your own UNIX Shell, part 1

$25

File Name: Lab_9._Write_your_own_UNIX_Shell,_part_1.zip
File Size: 376.8 KB

SKU: [Solved] Lab 9. Write your own UNIX Shell, part 1 Category: Tag:
5/5 - (1 vote)

PURPOSE: The purpose of this lab is to allow students to learn a user interface aspect of a UNIX shell.Student will work with process management and some basic system calls.Important note: please use sp1, sp2, sp3, or atoz servers for this lab.UNIX ShellWe will start with 3 built-in commands: cd (change directory), pwd (print working directory), and exit (exit shell).The built-in functions are not executed by forking and executing an executable. Instead, the shell process executes them itself.Your shell is basically an interactive loop: it repeatedly prints a prompt csc60msh , parses the input, executes the command specified on that line of input, and waits for the command to finish.FILES TO COPY:To get the file you need, first move to your class folder by typing: cd csc60The following command will create a directory named lab9 and put all the needed file into it below yourcsc60 directory.Type: cp -R /gaia/home/faculty/bielr/classfiles_csc60/lab9 .Spaces needed: (1) After the cp Dont miss the space & dot.(2) After the -R(3) After the directory name at the end & before the dot.After the files are in your account and you are still in csc60, you need to type: chmod 755 lab9This will give permissions to the directory.Next move into lab9 directory, and type: chmod 644 *This will give permissions to the file.Your new lab9 directory should now contain: lab9.cPlease follow these steps: Review the source codes, compile, and execute the programs. Examine the output texts to understand the behavior of each program. I have provided you with a simple shell template (lab9.c) that you can work from. You build your program from it. Read the template closely to identify the key components and understand its execution flow. You can compile the shell using the following command: gcc lab9.c Function main. Handling built-in Commands: There are three special cases where your shell should execute a command directly itself instead of running a separate process.o First, if the user enters exit as a command, the shell should terminate.o Second, if the user enters cd dir, you should change the current directory to dir by using the chdir system call. If the user simply types cd (no dir specified), change to the users home directory. The $HOME environment stores the desired path; use getenv(HOME) to obtain this.o Third, if the user enters pwd, print the current working directory. This can be obtainedwith getcwd() function.

5/5 – (1 vote)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Lab 9. Write your own UNIX Shell, part 1
$25