Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- srcpth='/Books/Spiritual/33-POH-Devotional/Scripts/'
- # Set default vars and output array
- srcfil='/Files/devot-scan.txt'
- tgtdir='/Projects/POH_Dev/'
- # Read source file into the first array
- readarray oray < $srcfil
- # Filter out blank lines & lines not containing '3T'
- for i in ${oray[@]}; do
- if [[ "$i" == '/3T/'* ]]; then
- nray+=( "$i" )
- fi
- done
- # Create the DB and Table
- MAKFIL='/data/MySQL/poh-make.sql'
- mysql -u $MUSER -p$MPASS < $MAKFIL
- # Read through the array and add to the MySQL DB/Table
- for i in ${nray[@]}; do
- # Make qry to see if record is already in the table
- tstqry='select poh_sdr from POH.poh-src WHERE poh_sdr=$i;'
- ret=$(mysql --user=$MUSER --password=$MPASS
- --database="POH" < "$tstqry" )
- if [ "$ret" -eq 0 ]; then
- echo "Inserting Record!";
- mysql INSERT INTO "poh-src` ( `poh_sdr`, `poh_cdt`, `poh_mdt`
- VALUES ("$i", NOW(), (NOW());
- fi
- done
- quit;
- exit;
- This errors on the INSERT line saying incorrect end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement