Added some sample bash scripts to the UNIX102 page.
This commit is contained in:
parent
aee5c22f92
commit
e09355b57c
@ -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
|
||||
|
11
unix102/appender.sh
Executable file
11
unix102/appender.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
while [ ${#} != 0 ]; do
|
||||
echo "${1}:"
|
||||
cat "${1}"
|
||||
echo ""
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
28
unix102/tickets_email.sh
Executable file
28
unix102/tickets_email.sh
Executable file
@ -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…
x
Reference in New Issue
Block a user