Skip to content

Instantly share code, notes, and snippets.

@arudmin
Created August 8, 2014 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arudmin/f510537654d26adfeebe to your computer and use it in GitHub Desktop.
Save arudmin/f510537654d26adfeebe to your computer and use it in GitHub Desktop.
Reading SMS from gammu folder
#!/bin/bash
DIR="/var/spool/gammu/inbox/*"
if [[ $1 == "-r" ]];
then
rm -rf $DIR
else
for f in $DIR
do
FILE=$f
TIME=`echo $f | cut -d '_' -f2`
SENDER=`echo $f | cut -d '_' -f 4`
f=$(basename $f)
echo $SENDER ${f:8:2}"."${f:6:2}"."${f:2:4}" "${TIME:0:2}":"${TIME:2:2}":"${TIME:4:2}
cat $FILE
printf "\n\n"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment