Skip to content

Instantly share code, notes, and snippets.

@asarver
Last active December 12, 2015 05:08
Show Gist options
  • Select an option

  • Save asarver/4719270 to your computer and use it in GitHub Desktop.

Select an option

Save asarver/4719270 to your computer and use it in GitHub Desktop.
LOCK="file.lock"
FILENAME="prob15.txt"
TEMPFILE="temp_file.txt"
count=5
one=1
i=1
end=1000
while [ $i -lt $end ]
do
if [ ! -e $LOCK ];
then
echo "lock file" > "$LOCK"
value=$(tail -1 $FILENAME)
count=`expr $value + $one`
echo "$count" >> "$FILENAME"
$i=`expr $i + $one`
rm "$LOCK"
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment