Skip to content

Instantly share code, notes, and snippets.

@SmetDenis
Last active August 29, 2015 14:26
Show Gist options
  • Save SmetDenis/e6c08b4cd22399a5b5bd to your computer and use it in GitHub Desktop.
Save SmetDenis/e6c08b4cd22399a5b5bd to your computer and use it in GitHub Desktop.
#!/bin/sh
# http://habrahabr.ru/post/49665/
prefix="/var/mail/sendmail/new"
numPath="/var/mail/sendmail"
if [ ! -f $numPath/num ]; then
echo "0" > $numPath/num
fi
num=`cat $numPath/num`
num=$(($num + 1))
echo $num > $numPath/num
name="$prefix/letter_$num.txt"
while read line
do
echo $line >> $name
done
chmod 777 $name
/bin/true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment