This works:
echo "Type the desired option
Option 1: See textfile
Option 2: Edit textfile
Option 3: Add line to the textfile"
read option
if [$option == 1]
then
cat database.txt
else
vim database.txt
fi
but this doesn't
file="database.txt"
echo "Type the desired option
Option 1: See textfile
Option 2: Edit textfile
Option 3: Add line to the textfile "
read option
if [$option == 1]
then
cat $file
elif [$option == 2]
then
vim $file
elif [$option == 3]
then
echo "Type your line:"
read newline
echo $newline >> $file
else
echo "None of the options were chosen"
fi
and this is the result whenever I choose one of the options:
stock1.sh: line 8: [1: command not found stock1.sh: line 11: [1: command not found stock1.sh: line 14: [1: command not found
I've have already tried removing the file variable and leaving it as database.txt, to no success