08-16-2009
Why?
$? is a test of the success / failure of the last command, not whether the results of the variable are positive or negative. As you assigned values to the variables, the test [ ] is only testing that they are set, and says nothing of their values.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to check two variables and if both are blank I want to set a flag:
the_f3_pid=`rsh $target ps -ef | grep "f3.eab" | awk '{print $2}'`
the_f7_pid=`rsh $target ps -ef | grep "f7.eab" | awk '{print $2}'`
if ; then
y=1
fi
I get an error:
./script_name: test: 0403-021 ]... (4 Replies)
Discussion started by: rcarnesiii
4 Replies
2. Shell Programming and Scripting
Hi folks
I have a snippet of code Which is like this
If ( ( A || B || C ) && D ) then
Do some thing....
elif exit
fi
How to rephrase this and use it so I dont get any Errors ...
Looking out for helpful replies ..
Thanks & Regards
Srikanth GR (1 Reply)
Discussion started by: srikanthgr1
1 Replies
3. Shell Programming and Scripting
Hello,
This must be a novice question to you folks. But I searched through various places and did not find an answer to this question:
How do we perform a logical OR operation using sed command? For example, I want to write a command that extracts all the text between pattern1 and pattern2 OR... (0 Replies)
Discussion started by: thejasviv
0 Replies
4. HP-UX
hi,
i was trying to club to test condition with if.
if -o ; then
it is giving me error message, i wanted to ask how can we check two condtions with one if. (1 Reply)
Discussion started by: babom
1 Replies
5. Shell Programming and Scripting
frnds..
can i perform an OR operation in sed syntax ?
if yes.. how?
I need to search for some 2-3 mail addresses in multiple files and delete all those... and instead of them.. I need to insert a new mail id...( these are also other emails in that list .. which sud not be affected )
is... (8 Replies)
Discussion started by: clx
8 Replies
6. Shell Programming and Scripting
Hi can someone please help me on this.
I need to perform this code:
Grep any lines that meets the following criteria
(A AND B) OR (A AND C)
I tried this code, but it didn't work
Grep-I "A &&B" | "A&&C" *.* $
thanks in advance (12 Replies)
Discussion started by: Needhelp2
12 Replies
7. Programming
Hi,
Please clear the 2 questions,
2 Questions,
1) Why the new as a operator? Is there any special reason why it can't be a function like malloc?
2) How are we considering sizeof(),new are as a opearartors? I know + - * / -> , . etc.. are operators, which criteria satisfied by sizeof()... (4 Replies)
Discussion started by: Nagapandi
4 Replies
8. UNIX for Dummies Questions & Answers
All,
THe below is my script , when i use this i am getting nothing . could any one help me to know what is the use of the << operator below
su - $8 << supo
echo "exportsph $2 $1 $3 $4"
exportsph $2 $1 $3 $4
supo
i also tried as individual command su - userid << supo , when i do... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
9. Shell Programming and Scripting
I have this script to uvscan-update. Seems like that i am getting logical error at the end of the script. It is updating the script and also giving the error message to update it manually. I have deleted the DAT files to see if it will create new and it does. Below is the error and the script: ... (1 Reply)
Discussion started by: mk07md
1 Replies
10. UNIX for Dummies Questions & Answers
im new to bash scripting and im just using online tutorials and trial and error. i wanted to write a script to read numbers from a file and find their sum:
#!/bin/bash
theSum=0
for line in $(cat numbers.txt)
do
let "theSum = theSum + $line"
echo "$line"
done
echo "The sum is... (3 Replies)
Discussion started by: astrolux444
3 Replies
while(n) Tcl Built-In Commands while(n)
__________________________________________________________________________________________________________________________________________________
NAME
while - Execute script repeatedly as long as a condition is met
SYNOPSIS
while test body
_________________________________________________________________
DESCRIPTION
The while command evaluates test as an expression (in the same way that expr evaluates its argument). The value of the expression must a
proper boolean value; if it is a true value then body is executed by passing it to the Tcl interpreter. Once body has been executed then
test is evaluated again, and the process repeats until eventually test evaluates to a false boolean value. Continue commands may be exe-
cuted inside body to terminate the current iteration of the loop, and break commands may be executed inside body to cause immediate termi-
nation of the while command. The while command always returns an empty string.
Note: test should almost always be enclosed in braces. If not, variable substitutions will be made before the while command starts execut-
ing, which means that variable changes made by the loop body will not be considered in the expression. This is likely to result in an
infinite loop. If test is enclosed in braces, variable substitutions are delayed until the expression is evaluated (before each loop iter-
ation), so changes in the variables will be visible. For an example, try the following script with and without the braces around $x<10:
set x 0
while {$x<10} {
puts "x is $x"
incr x
}
SEE ALSO
break(n), continue(n), for(n), foreach(n)
KEYWORDS
boolean value, loop, test, while
Tcl while(n)