I was making this shell script to become faster in plotting data with gnuplot. It is the first s.s that I write so I'm having some difficulties. All was good until I started to make the if statement. Now executing this returns this error:
prova2.sh: 53: prova2.sh: Syntax error: end of file unexpected (expecting "fi")
This is an example. What am I doing wrong here?
...
if ["$ANSWER" == "S"]
then
ANSWER= set grid
else
ANSWER=""
echo "you want the plot whit boxes with lines or with points?"
read HOW
if ["$HOW" == "boxes"]
then
P= boxes
else if ["$HOW" == "lines"]
then
P= lines
else if ["$HOW" == "points"]
then
P= points
gnuplot <<EOF
...
fi
expecting "fi"
...[
and]
are keywords so must be separated (yes, both sides) from other text or punctuation with a space.if
...fi
issue yourself now.else if
should be written aselif
in shell scriptsA=one
is not the same asA= one
. The first assigns the stringone
to the variableA
. The second setsA
empty and runs the commandone
. Review your own code as pasted here to identify which form you're using and determine whether it's really correct, or not.