Added some sample bash scripts to the UNIX102 page.

news-update
ehashman 11 years ago
parent aee5c22f92
commit e09355b57c
  1. 3
      common.mk.in
  2. 2
      unix102/Makefile
  3. 11
      unix102/appender.sh
  4. 28
      unix102/tickets_email.sh

@ -63,4 +63,5 @@ $(OUTDIR)%.pem: %.pem
cp -f $< $@
$(OUTDIR)%.tar: %.tar
cp -f $< $@
$(OUTDIR)%.sh: %.sh
cp -f $< $@

@ -1,3 +1,3 @@
FILES = index.html cheatsheet.pdf unix101.pdf vim_exercise.tar
FILES = index.html cheatsheet.pdf unix101.pdf vim_exercise.tar appender.sh tickets_email.sh
RELDIR = unix102/
include ../common.mk

@ -0,0 +1,11 @@
#!/bin/bash
while [ ${#} != 0 ]; do
echo "${1}:"
cat "${1}"
echo ""
shift
done
exit 0

@ -0,0 +1,28 @@
#!/bin/bash
# Sends email when Beta tickets are available.
TEST=`mktemp`
wget -q --no-check-certificate https://ticketdriver.com/betawater/buy/tickets/ -O ${TEST}
LINEMATCH=`mktemp`
egrep '2012-04-13|Laidback|Luke' ${TEST} >> ${LINEMATCH}
if [ $? = 0 ]; then
SUBJECT="BUY BETA TICKETS"
EMAIL=$1
EMAILBODY=`mktemp`
NUMBER=$2
echo "tickets_email: Tickets available!!
https://ticketdriver.com/betawater/buy/tickets/" >> "${EMAILBODY}"
echo -e "\nMatching line: " >> "${EMAILBODY}"
cat "${LINEMATCH}" >> "${EMAILBODY}"
mail -s "${SUBJECT}" "${EMAIL}" < "${EMAILBODY}"
if [ $NUMBER -n "" ]; then
echo "go buy tickets" | mail -s "${SUBJECT}" "${NUMBER}@msg.telus.com"
fi
rm "${EMAILBODY}"
fi
rm "${TEST}" "${LINEMATCH}"
Loading…
Cancel
Save