POS/420 Version 9 / 1
University of Phoenix Material
Linux® ScriptWorksheet
To:Bob O’connor
From:Nnanke Edet
Date: 10/04/2011
Note: Prior to beginning the Linux® Script Worksheet, update the PATH variable to add your folder from last week.You will find how to do this on p. 134 of Linux® Command Lineand Shell Scripting Bible.
Linux® Script 1
RequirementsIn the same folder as last week,create a new file called week3prog1[name].scr.
Change the permissions on this new file to add the execute bit for user, group, and owner.
Edit your new file using Gedit or VIand change it so it performs the following actions:
- Display the date
- Display the words Hello World
- Display information about users that are currently logged in
Save the file and type your file name to execute.
Source Programs:
Insert your source code here.
Output Results:
Insert the output here. Use a screen shot of the output with input requirements specified in the assignment.
Linux® Script 2
RequirementsIn the same folder as last week,create a new file called week3prog2[name].scr.
Change the permissions on this new file to add the execute bit for user, group, and owner.
Edit your new file using Gedit or VIand change it so it performs the following actions:
- Using a line after #!/bin/bash,take the output of the ps –e command and pipe it to the sort command.
- After it has been piped to the sort command, redirect that output to a file called psfile.
Source Programs:
Insert your source code here.
Output Results:
Insert the output here. Use a screen shot of the output with input requirements specified in the assignment.
Linux® Script 3
RequirementsIn the same folder as last week,create a new file called week3prog3[name].scr.
Change the permissions on this new file to add the execute bit for user, group, and owner.
Create two files.
- File1 has one line with the value of 5.
- File2 has one line with the value of 100.
- Read the values from the two files above (file1 and file2).
- Divide the value from file2 by the value in file1.
- Output the result of this calculation to a new file called file3.
Source Programs:
Insert your source code here.
Output Results:
Insert the output here. Use a screen shot of the output with input requirements specified in the assignment.