scripting lab exercise#!/bin/sh # SCRIPT 1: # # 1) create a new directory # 2) list man page for THREE COMMANDS # 3) strip formatting characters from file # 4) change blank lines to # # 5) change permissions to 664 # #!/bin/sh # USAGE="make-man.sh 1 2 3 (awk sed grep)" # cd mkdir Manpage-list man $1 | col -b > Manpage-list/$1.man man $2 | col -b > Manpage-list/$2.man man $3 | col -b > Manpage-list/$3.man # perl -pi -e '/^[ ]*$/d' Manpage-list/*.man perl -pi -e 's/^$/#/g' Manpage-list/*.man chmod 664 Manpage-list/*.man # SCRIPT 2: # # 1) list files # 2) ask user to select a file # 3) copy file with date suffix # 4) cat file #!/bin/sh # date: April 4, 2002 # author: john # script to identify list of files # then provide user with option of opening # # NOTE: must be run in the directory where the files are # # create a menu COUNT=0 for x in `ls *.man` do set * COUNT=`expr $COUNT + 1` echo "$COUNT> $x $!" done set * echo echo "Enter a number from 1 to $#: \c" read LIST while [ $LIST != 1 ];do LIST=`expr $LIST - 1` shift done echo "You picked \"$1\"!" cp $1 "$1.`date +%y%b%d`" cat $1 exit |
The Art of Linux System Administration published by O'Reilly Media Study Guide for the LPIC-2 Certification Exams |
Wagoneers FULL SIZE JEEPS JeepMeister "Jeep is America's -Enzo Ferrari MeisterTech Diesels + |
One Page Overview of Linux Commands click for an image of the 5 essential Linux commands An Intro to Linux |
at Midway Auto on SR9 in Snohomish, or at Northland Diesel in Bellingham, WA |