In the following script I am testing how to count how many times a command runs.
#!/bin/bash
echo "Hello"
scount=$?
if [ $scount -eq 0 ]; then
count=$(cat ${scount})
else
count=0
fi
((count++))
echo ${count} > ${scount}
echo "Scount: $count"
This is the output I receive. I am confused as to why I am getting the cat: 0: No such file or directory
message.
Hello
cat: 0: No such file or directory
Scount: 1