That's because it is an "orphan" else branch.
It does not have a corresponding if-elsif branch.
I have added line numbers to your code and added color coding to make it easier to spot the if/elsif/else branches.
The closing brace at line 217 is for the opening brace at line 19.
A few points to remember about if/elsif/else branch:
1) If you're going to use this branch, then there must be exactly 1 "if" branch. It must be at the beginning. It must be followed by a condition. You cannot have more than one "if" branch in the same "if/elsif/else" branch.
2) Thereafter, there can be 0, 1 or more "elsif" branch(es). They must be after the "if" branch. They must be followed by a condition i.e. any expression or string that evaluates to true or false.
3) Thereafter, there can be 0 or 1 "else" branch. They do not check any condition. You cannot have more than 1 "else" branch. It must be at the end, after the "if" or "elsif" branches.
---------- Post updated at 11:10 AM ---------- Previous update was at 10:59 AM ----------
By the way, if you use editors like vim, gvim, emacs etc. then they have keyboard shortcuts that allow you to "jump" between opening/closing braces.
If you use GUI editors on Windows or Linux, then many of them show vertical lines on the left that span entire "if", "elsif", "else" brances.
In some of them, you could even click on small icons on the left to expand or collapse these brances.
These are small things, but they make coding much easier.
Hello,
also with the help of some great users of this forum, I have created following shell script.
MM=120
GG=5000
# get size of directory
szm=$(du -s --block-size M ./192.168.1.xxx | awk '{print int($0)}')
data=$(date --rfc-3339=seconds)
if ; then # too big delete older files
... (10 Replies)
Hello,
Please advise. Scoured this site, as well as google for answers. However if you do not know what to search for, it's a bit hard to find answers.
INPUT:
ACTASS=
802
BASECOS=
279
COSNCHG=
3
CUSCOS=
52
UPLDCOS=
2
DESIRED OUTPUT:
ACTASS=802
BASECOS=279 (13 Replies)
I have a text file for which i need a script which does some fancy search and replace.
Basically i want to loop through each line, if i find an occurance of certain string format then i want to carry on search on replace another line, once i replaced this line i will contine to search for the... (7 Replies)
PFA file "color.txt".
Note : There is no newline character in the file. I have manually inserted the newline char to make it easy to understand.
I am expecting out in the form as specified in second file "out.txt"
I need a perl script to perform the task.
Thanks in advance. (2 Replies)
I need to write a perl script to execute external programs and grab the output and return code. Each program should be killed if it has not completed within X seconds.
Imagine that the script goes something like this :
@commands = &get_commands();
foreach $cmd (@commands) {
$pid =... (4 Replies)
ok, so what i want to do is make a script that will do the following:
take out from a command in the terminal
put that output into a text file already on my computer.
the only thing is that i need to put the output in the file kinda weird: i need to take it and put each character of output... (13 Replies)
I have a script that I need to create tha involves moving files and renaming them(see previous post)
Are there any websites with user made shell scripts? (5 Replies)
I'm attempting to create a Perl script that will:
Take the contents of the usernames.tmp file
(usernames.tmp is created from an awk one-liner ran against /etc/passwd)
Take one line at a time and pass it to the su command as a users name.
This should go on until there is no more name to... (10 Replies)
I need to query a http site and then parse the xml results, this works well if I use the string in IE but I require an automated solution.
I have tried using the following as well as HTTP::Request, nothing seems to work any suggestions would be appreciated, I have tried diffrnt things I found on... (7 Replies)