Documente Academic
Documente Profesional
Documente Cultură
cd 2400/Labs
mkdir lab3
cd lab3
Step 2: Get familiar with ls, cd, cp, cat, mv and man UNIX commands
a. You already have used the ls command in the previous labs. To get more
details on this command type man ls at the system prompt. When you are done
with the reading enter q to quit.
b. Type
ls
/home/jsjsubm/cs2400
c. Type
ls -l /home/jsjsubm/cs2400
should see (among other things)
drwxr-xr-x
2 jsjsubm
faculty
-rw-r--r-1 jsjsubm
. . . . .
faculty
The first character on the line for dir6 indicates that dir6 is a directory and the first
character on the line dir8 (-) indicates that dir8 is a regular file. The next nine
characters represent three categories owner, group and world (you). Each
category represents r for read, w for write and x for execute permissions of a file.
For example, look at dir8, the owner has read and write privileges, but the group and
you have only read privileges.
d. Answer questions 1 4 on the answer sheet.
CS2400
Laboratory Assignment #3: More UNIX commands, math involving integers
and selection control structures
(100 pts)
e. You can display the contents of a file by typing the following command
cat /home/jsjsubm/cs2400/dir8
f.
g. First type pwd to make sure that you are in lab3 directory.
h. To copy the files from dir1 to your directory type
cp /home/jsjsubm/cs2400/dir1/* .
(need the dot at the end this signifies the current directory as destination)
j.
k.
mv ~/2400/Labs/lab3/yet_another_test .
(need the dot at the end this signifies the current directory as destination)
~ sign is the current users home directory.
n. Answer question 10 on the answer sheet.
CS2400
Laboratory Assignment #3: More UNIX commands, math involving integers
and selection control structures
(100 pts)
of sales $4395.00
pays $659.50
pays $659.25
is better
./a.out
Enter the weekly sales amount > 4500.00
Amount
Plan 1
Plan 2
Plan 2
of sales $4500.00
pays $670.00
pays $675.00
is better
Begin your program with the standard comment box. The program should be
thoroughly documented and follow the style guidelines discussed in class.
Also turn in a printout of your source code only with the cover sheet showing
name/date/time.
Be sure to electronically submit all code from this lab on Blackboard.
3
CS2400
Laboratory Assignment #3: More UNIX commands, math involving integers
and selection control structures
(100 pts)
2 points
2 points
1 points
prompts to user.
8 points
1 point
style (indenting)
2 points
2 points