0% found this document useful (0 votes)
30 views2 pages

CIS 218 LAB #1 Shell Cmds Advanced UNIX

The document provides instructions for a lab assignment on shell commands in UNIX. Students are asked to create a directory called Lab1, run various commands inside it to set and view environment variables, create scripts and aliases, and run processes in the background and foreground. The assignment must be completed within 2 weeks and the results emailed to the instructor.

Uploaded by

Uday Naikwadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

CIS 218 LAB #1 Shell Cmds Advanced UNIX

The document provides instructions for a lab assignment on shell commands in UNIX. Students are asked to create a directory called Lab1, run various commands inside it to set and view environment variables, create scripts and aliases, and run processes in the background and foreground. The assignment must be completed within 2 weeks and the results emailed to the instructor.

Uploaded by

Uday Naikwadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CIS 218 LAB #1 Shell Cmds Advanced UNIX

Instructions: AFTER debugging all the below problems,

- Run the command “script” ,


- echo your name, class and section, Lab1”
- run the below commands, then “exit” when complete
- E-Mail to the instructor when complete.

This assignment is due in 2 weeks.

Create a Directory Lab1 . cd to Lab1.

1. Run the command that gives you a list of all the environment variables that are currently
set.

2. Using a pipe to the wc command, find out how many environment variables are currently
set.

3. Create a new variable called MYVAR and set its value to "myvalue". Use the command
export MYVAR to allow MYVAR to be used by sub-programs of the shell. Repeat
steps 1 and 2

4. Create a BASH script called “hello.sh” that will echo “Hello World” to the screen. Run
this using a relative path and absolute path to run the program. Why can you run it
without a PATH?

5. Create the below aliase commands:


o 'll' for 'ls -l'
o 'la' for 'ls -la | less'
o 'psall' for 'ps -ef'
o 'up' for 'cd ..'
o 'back' for 'cd .'

Run these alias commands in your HOME directory.


6. Create the shell script forever.sh

#!/bin/bash

while [ 1 ]

do

echo Hello World

sleep 10

done

Run it.

- Put the script job to sleep


- Put the script job in the background
- Display jobs
- Bring the script job to the foreground.
- Kill the script job

7.

You might also like