Web hosting comparison - 19 # check that the address book exists
19 # check that the address book exists 20 21 MYADDRESSBOOK=”$HOME/addressbook” 22 if [ ! -f “$MYADDRESSBOOK” ] ; then 23 printERROR “$MYADDESSBOOK does not exists, or is not a file.” 24 exit 1 25 fi 26 27 # initialize the variables holding the location of the 28 # temporary files 29 TMPF1=/tmp/apupdate.$$ 30 TMPF2=/tmp/abdelets.$$ 31 32 # function to clean up temporary files 33 34 doCleanUp() { rm “$TMPF1″ “$TMPF1.new” “$TMPF2″ 2> /dev/null ; } 35 36 # function to exit if update failed 37 Failed() { 38 if [ “$1″ -ne 0 ] ; then 39 shift 40 printERROR $@ 41 doCleanUp 42 exit 1 43 fi 44 } 45 46 # make a copy of the address book for updating, 47 # proceed only if sucessful 48 49 cp “$MYADDRESSBOOK” “$TMPF1″ 2> /dev/null 50 Failed $? “Could not make a backup of the address book.” 51 52 # get a list of all matching lines from the address book copy 53 # continue if one or more matches were found 54 55 grep “$1″ “$TMPF1″ > “$TMPF2″ 2> /dev/null 56 Failed $? “No matches found.” 57 58 # prompt the user for each entry that was found 59 60 exec 5< "$TMPF2" 61 while read LINE <&5 62 do 63 64 # display each line formatted 65 66 echo "$LINE" | awk -F: '{ 67 printf "%-10s %sn%-10s %sn%-10s %sn%-10s %snn", 68 "Name:",$1,"Email:",$2,"Address:",$3, "Phone:",$4 ; 69 }' 70 71 # prompt for each line, if yes try to remove the line 72
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.