You need to preserve the $? variable, otherwise it will get altered by the next command:
Try:
--
and use -gt instead of >
--
Double brackets will work with bash or ksh, single brackets will also work with these shells, but in addition with any POSIX compliant shell (and also classic Bourne shell)...
Last edited by Scrutinizer; 12-06-2012 at 04:08 PM..
This User Gave Thanks to Scrutinizer For This Post:
From the Apache thread in the Adanced forum:
Thats because your browser interprets anything within angle brackets to be an HTML tag. You need to quote these brackets if you want them to appear correctly. The proper quotes are:
&lt; for <
and
&gt; for >
So, for example, you would have... (1 Reply)
:D i am pretty much new to scripting and don't want to pick up bad habits so I am trying to get myself to use brackets in my scripts since I plan on using them alot.. !
in this example of a script I wrote I can not figure out where the brackets go can anyone give me some insight into the use of... (3 Replies)
Hi,
I would like to know about the usage of brackets to negate a set of boolean evaluations
an equivalent to what i am trying is below
if or || ] ]
then
echo"valid time of day"
else
echo "invalid input"
exit
fi
the bracket structue as mentioned doesnt work .. i am using ksh.... (4 Replies)
hi all,
i want to delete brackets in all the file and to keep the string or data between them ( example Q --> Qxxx) with sed command..
thanks (4 Replies)
Hello guys, I'm brand new to UNIX. I've installed Cygwin as recommended, but here are some problems. Well, man command doesn't work and I also don't know how to create a file or even how to type (). With () the program gives me an error message. Please tell me how to do all these things. Best... (4 Replies)
Hi
I am having hard time getting this right and need some help. I Have several log files, and everyone contains the following 3 lines at the end:
4 ETW000 Disconnected from database.
4 ETW000 End of Transport (0000).
4 ETW000 date&time: 13.01.2011 - 08:03:28
I need to capture the value... (7 Replies)
Hello,
I am trying to write a script using ksh. And I want to get the value within the first brackets of a string. For example:
14/04/11 11:35: 00 This is (nn) from the earth.
Then i hope to get nn in this case.
Can any one advise me how to implement it?
Thank you very much!
nn (2 Replies)
Hi All,
I have a text file which looks like this:
computer programming
systems engineering
I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this:
computer programming
systems engineering
I am using... (3 Replies)
Hi,
If you suppose that you have two columns of numbers, and I want to merge these two columns into one and put a bracket around it. and perphaps add a dash between two numbers.
input.txt
1 2
3 4
5 6
7 8
output.txt
(1-2)
(3-4)
(5-6)
(7-8)
Thanks in advance!
Please use... (2 Replies)
Hi
I am having hard time getting this right and need some help. I Have 3 files, and everyone contains the following:-
File1
Today, we have Name(Jack) Age(19) Class (A2)
Today, we have Name(Kim) Class (G9)
File2
Today, we have Name(Lee) Age(19) Class (A2)
Today, we have... (8 Replies)
Discussion started by: samsan
8 Replies
LEARN ABOUT V7
return
exit(1) User Commands exit(1)NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
SYNOPSIS
sh
exit [n]
return [n]
csh
exit [ ( expr )]
goto label
ksh
*exit [n]
*return [n]
DESCRIPTION
sh
exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of
the last command executed (an EOF will also cause the shell to exit.)
return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe-
cuted.
csh
exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the
expression expr.
The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches
for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to
jump to a label that occurs between a while or for built-in command and its corresponding end.
ksh
exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8
bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing
a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit
except for a shell which has the ignoreeof option (See set below) turned on.
return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the
least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return
is invoked while not in a function or a '.' script, then it is the same as an exit.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO break(1), csh(1), ksh(1), sh(1), attributes(5)SunOS 5.10 15 Apr 1994 exit(1)