Perl Assignment #4:  Subroutines

 

CS 447/647

Spring, 2012

 

 

Due: 2/21/12

 

Read chapter 4 of Learning Perl.  Do exercises 1, 2 and 4.

 

script assign4.txt

PS1=’$ ‘

cat ex4-1.pl

perl ex4-1.pl

cat ex4-2.pl

perl ex4-2.pl

…

exit

 

Submit your 2 script sessions through WebCampus.

 

Hands-On Exercise

 

      Create two new users:

user1 with the useradd command

user2 manually editing the config files

 

Test hard and soft links:

 

script handson4.txt

PS1=’$ ‘

mkdir links

cd links

echo "Hello World" > test1

ln test1 test2

ln -s test1 test3

# How many hard links does test1 have now?

ls -l

head test1 test2 test3

ls -i test1

# Find all the files with the inumber returned by the previous command

# Substitute the inumber from the ls above for 133537 in the find command

find  $HOME -xdev -inum 133537 –print 2> /dev/null

rm test1

# How many hard links does test2 have now?

ls –l

# continued on next page …

 

# /proc exercise:

#How many CPUs does your system have?  What model? What speed?

egrep "(model name|MHz)" /proc/cpuinfo

#How much memory does your system have?  How much free?

head -5 /proc/meminfo

#How many drives are attached to your system?

cat /proc/scsi/scsi

#What version of the kernel are you using?

cat /proc/version_signature

 

# show the two new users you created

tail –n 3 /etc/passwd

 

exit