#!/bin/sh -u # Test #2 answer - Script Section - 64 marks - 6 of 15% # -Ian! D. Allen idallen@idallen.ca # Step 1 - 3 marks PATH=/bin:/usr/bin ; export PATH umask 022 # Step 2 - 1 mark pwd # Step 3 - 2 mark echo 'Ian D. Allen alleni@algonquincollege.com' # Step 4 - 2 mark echo "$PATH" # Step 5 - 4 marks date | tr 'a-z' 'A-Z' # Step 6 - 2 marks echo "It's a nice" '"day" today.' # or echo "It's a nice \"day\" today." # Step 7 - 6 marks file /bin/* | grep 'script' | wc -l # Step 8 - 6 marks awk -F: '{print $7}' /etc/passwd | sort | uniq # Step 9 - 7 marks last | grep 'reboot' | awk '{print $5}' | sort | uniq # Step 10 - 11 marks tr ':' '\n' tmp # or wget 'http://idallen.com/openformats.txt' grep 'Microsoft USA' tmp | wc -l # Step 13 - 3 marks grep ' http' tmp # Step 14 - 2 marks rm tmp # Step 15 - 4 marks id | tr '=(' ' ' | awk '{print $2}' # or grep 'idallen' /etc/passwd | awk -F: '{print $3}' # or id | awk -F= '{print $2}' | awk -F'(' '{print $1}' # or id | tr -c '0-9' ' ' | awk '{print $1}' # or id -u (always RTFM!)