Answers for "bash loop counter"

0

bash loop counter

TEMPFILE=/tmp/$$.tmp
echo 0 > $TEMPFILE

# Loop goes here
  # Fetch the value and increase it
  COUNTER=$[$(cat $TEMPFILE) + 1]

  # Store the new value
  echo $COUNTER > $TEMPFILE

# Loop done, script done, delete the file
unlink $TEMPFILE
Posted by: Guest on May-16-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language