Just trying to expand my bash scripting knowledge and i keep getting a syntax error...
Basically what i'm trying to do is based on ownership of a file i need to perform some commands. In order to do this i've stripped the script down to the base...
If file is owned by dave then do this but if it is owned by bob then do this then end.
#!/bin/bash
#
fname="testfile"
var1=`ls -l $fname | awk ' { print $ 3 }'`
if [ $var1 = dave ]; then
mail -s "Owned by Dave"
test@mail.com
elif
if [ $var1 = bob ] ; then
mail -s "File is owned by bob"
test@mail.com
fi