This is what I'm trying to do:
I want to make a script that i can invoke either with counter_use in
or counter_use out
. If i type in
i want a counter to add +1 to the numeric value inside a file called "counter", if I type out
i want to subtract 1 from the file.
I also want the script to output Logged in
if the value in counter are equal to or higher than 1 and Not logged in
if the counter is equal to 0.
The last part is runnig if i hard code the counter to a specific number. The problem is the first part.
echo "In or out?"
read input > counterFile
if grep -q "in" counterFile
then //what should I do here so that it adds +1 to a file called
counter?
elif grep -q "out" counterFile
then //what should I do here so that it subtracts -1 to a file called
counter?
if [ $counter -ge 1 ]
then
echo "Logged in"
elif [ $counter -eq 0 ]
then
echo "Not logged in"
else
echo "Wrong input"
fi