07-11-2008
Not sure of two of your variables
I see where you try to set COUNT . (I don't think it will do what you think it will in this manner.) However you then do an if on $abc.dat and another on $def.dat -- but I do not see where these are set. Perhaps this is your issue since an undefined variable will be less than 4 when doing an "if" condition.
I think you want something more like
COUNTabc=$(cat ../data/abc.dat* | wc -l)
COUNTdef=$(cat ../data/def.dat* | wc -l)
[Each of the above will set a variable with the count for number of lines.]
and then do your "if" conditions with $COUNTabc and $COUNTdef
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler."
What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies
2. Programming
I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler."
What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies
3. UNIX for Dummies Questions & Answers
I want to set a variable to be any number of dashes. Rather than doing the following:
MYVAR="------------------"
I'd like to be able to set the variable to, say, 80 dashes but don't want to have to count 80 dashes. Is there a way to do this? (2 Replies)
Discussion started by: photh
2 Replies
4. Shell Programming and Scripting
L=0
cat test.sh | while read line
do
L='expr $1 + 1'
echo $L
done
echo $l
>>> the echo $L at the end produces 0 but i actually want it to produce the number of lines - any idea why this is happening? (16 Replies)
Discussion started by: penfold
16 Replies
5. UNIX for Dummies Questions & Answers
I need some syntax help (working in a bash shell)
I have a variable which is a filename with an extension, and I need to create another variable with the same name but a different extension
To explain, the input file should be called something like "filename.L1" and the output file should be... (1 Reply)
Discussion started by: Slanter
1 Replies
6. Shell Programming and Scripting
How do you set a varible with information that contains a string and also another variable? For example:
subject="Attention: $name / This $type needs your attention"
The $xxxx are of course other variables that I instantiated earlier. Is it like Java where you have to use double quotes and... (1 Reply)
Discussion started by: briskbaby
1 Replies
7. UNIX for Dummies Questions & Answers
In my script, I have the following command....
du -sk `ls -ltd sales12|awk '{print $11}'`|awk '{print $1}'
it returns the value
383283
I want to modify my script to capture that value into a variable. So, I try doing the following...
var1=`du -sk `ls -ltd sales12|awk '{print... (5 Replies)
Discussion started by: tumblez
5 Replies
8. Programming
Hi,
I already have one CPP program which invokes the C program.And the C program contains whole function definitions..!This is a working program..I have to enable the logs in both CPP as well as in the C program ..!So I am reading the enviornmental variable log path from the CPP and doing the... (2 Replies)
Discussion started by: Kattoor
2 Replies
9. Shell Programming and Scripting
Hi,
i have a variable which i would like to set inside an if block
for example
IS_VAR=0
if
then
IS_VAR=1
fi
echo IS_VAR
the last echo statement gives 0.So setting variables in the if block doesnt have effect outside the block?Is there any workaround for this?
Thanks ,
Padmini (11 Replies)
Discussion started by: padmisri
11 Replies
10. UNIX for Dummies Questions & Answers
Hi ,
Whenever i want to start tomcat server I need to go to <tomcatdir>\bin
and execute startup.sh file.
How would i make this happen whenever i start my machine?
Also want to know How would i set the variable at startup.
for example
I want to set JAVA_HOME and JRE_HOME whenever the... (3 Replies)
Discussion started by: pinga123
3 Replies
incr(3tcl) Tcl Built-In Commands incr(3tcl)
__________________________________________________________________________________________________________________________________________________
NAME
incr - Increment the value of a variable
SYNOPSIS
incr varName ?increment?
_________________________________________________________________
DESCRIPTION
Increments the value stored in the variable whose name is varName. The value of the variable must be an integer. If increment is supplied
then its value (which must be an integer) is added to the value of variable varName; otherwise 1 is added to varName. The new value is
stored as a decimal string in variable varName and also returned as result.
Starting with the Tcl 8.5 release, the variable varName passed to incr may be unset, and in that case, it will be set to the value incre- |
ment or to the default increment value of 1.
EXAMPLES
Add one to the contents of the variable x:
incr x
Add 42 to the contents of the variable x:
incr x 42
Add the contents of the variable y to the contents of the variable x:
incr x $y
Add nothing at all to the variable x (often useful for checking whether an argument to a procedure is actually integral and generating an
error if it is not):
incr x 0
SEE ALSO
expr(3tcl)
KEYWORDS
add, increment, variable, value
Tcl incr(3tcl)