Hi i as you may already know i am creating a menu driven program. I have chosen to take the approach of implementing each interface individually, after adding another interface and attempting to run the program i am faced with the following error:
./Assigntest: line 32: syntax error near unexpected token `)'
./Assigntest: line 32: `2)clear'
The code i am working is included below and i have highlighted in red the newly added section where i think the error is being generated from.
If someone could please ammend this for me and explain where i am going wrong then i could apply this to further interfaces and would also decrease number of posts from me (not that i dont like this forum lol). Thanks
Sorry i do not quite understand your answer if possible could you please ammend it in the code i posted earlier so i can get a better idea for what you mean. I really appreciate this.
Once you align your code correctly so you will be able to see where each case begins and ends, you will then also see where to correctly terminate your options and case statements.
For example:
Sorry i do not quite understand your answer if possible could you please ammend it in the code i posted earlier so i can get a better idea for what you mean. I really appreciate this.
Check your code where you have embedded the case statements and make sure that your case statements follow the correct syntax. Your error seems to be an issue with the syntax. It appears to me that you have missed to put ;; in some of your case statements.
Ok i have taken your advised indented my code and i have managed to fix my problem but unfortuantely now another small one has arisen.
The problem is that executing my commands requires two presses of the ENTER key as opposed to the originally being pressed once as one would expect, for example when quitting the program you are asked "Are you sure you want to quit?" after pressing Y you then have to press enter twice before the program is closed whereas before i was once you would expect. My edited code has been included below:
I hope you can understand what i am trying to get across, if not just say so i can explain. Also if possible could you please add any ammendmants recommended into the code i have supplied so i know exactly where to place them. Thanks alot for your help.
...
The problem is that executing my commands requires two presses of the ENTER key as opposed to the originally being pressed once as one would expect, for example when quitting the program you are asked "Are you sure you want to quit?" after pressing Y you then have to press enter twice before the program is closed whereas before i was once you would expect.
...
That's because the script is logically flawed. After displaying the initial menu with the header "OPERATOR ADMINISTRATIVE TOOL", you are capturing the user's choice twice - once in "menunumber" and the second time in "menunumber3". Ideally, you should capture the choice in one variable only and then compare this value using the case construct.
Here's the modified script with proper indentation. Note how the user's input is captured *only* in one variable - "menunumber", which is then compared to 1, 2, and Q|q.
Of course, you will have add the appropriate menus and sub-hierarchies for 3, 4, 5 as well for this script to work for those choices.
Hope that helps,
tyler_durden
____________________________________________________
"Only after disaster can we be resurrected."
Greetings!
I'm trying to get dpkg to just completely extract a multi-part *.deb archive set into a single folder called "output". Simple?
Hmmmm....
dpkg --noforce --unpack *.deb /output/Console after ops:
However, "--noforce" is taken directly from the helpfile Options listing as furnished... (8 Replies)
Hi Experts,
I was looking at the below link, for finding words next to it, And unable to understand this syntax:
Can any one please explain , what is meaning of this code:
if ( F )
s = s ? s OFS $i : $i
from:... (4 Replies)
Hi All,
I'm trying to write a simple if statement in TCSH and I honestly can't figure out what I'm doing wrong. I've played around with all sorts of permutations of syntax.
if ($DESKTOP_SESSION == "kde") then
replace "forceFontDPI=0" "forceFontDPI=96" --... (0 Replies)
Hello all. Need a bit of help...
I have :
previous_tmp0=`cat tmp0.txt`
previous_tmp1=`cat tmp1.txt`
previous_tmp2=`cat tmp2.txt`
previous_tmp3=`cat tmp3.txt`
previous_tmp4=`cat tmp4.txt`
previous_tmp5=`cat tmp5.txt`
previous_tmp6=`cat tmp6.txt`
previous_tmp7=`cat tmp7.txt`
Now I... (5 Replies)
I'm running mysql in a bash script
mysql <<EOF
query
EOF
one query is like this:
UPDATE $dbname.$prefix"config" SET value = $var WHERE "$prefix"config.name = 'table colname';
with variable
but it's giving an error
i'm not sure what to put for
"$prefix"config.name
the table... (3 Replies)
Hi,
I am facing issues in my shell script while trying to add two variables. Look at the snippet below for details:
# Initially variable SAMPLE1 and SAMPLE2 are set from different sources. Have trucated decimal to avoid numeric errors in expr
SAMPLE1=`/usr/bin/top -n 1 | head -3 | tail -1... (3 Replies)
Hello
I have tried to my best ability to work around this script tht will reference my m-names.txt which contains the format of:
168.16.0.0/16
169.56.0.0/16
132.2.0.0/16
122.5.0.0/16
Then I call a cli named getzoneprof that will set the $subnet from each of the lines in the... (6 Replies)
Hi all,
I am struck with syntax for long time,
Need to purge some lines from given file
Not able to use value of $x
Example of ksh script...
Facing some syntax issue.
Have Tried ‘with single , double ,backtick “” ` and \ escape character , doesn't seem to work.
<line 1> echo $x #... (2 Replies)
Hi,
I am totally new to C programming on Sun Solaris environment. I am an active member on the UNIX forum and a good shell programmer.
I am trying to achieve some calculations in C programming. I have the pseudo code written down but don't know the syntax. I am reading a couple of books on C... (4 Replies)