csh if loop variable condition check peroblem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting csh if loop variable condition check peroblem
# 1  
Old 11-06-2009
csh if loop variable condition check peroblem

Hi,


I have variables like
Code:
var1
var2
var3
var4

in

if loop i am trying to check the condition
Code:
if(variable == "var[1-4]") then
echo $variable 
endif

My main doubt is how to compare the var variable, which is having digit at the end.

Thanks in advance
vasanth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check two condition in while loop

Hi, I Have to check two condition in while loop every 2 minutes. while loop is accompanied with number of times it will check.Please help in putting the two condition in while loop as appropriate. z= input value, A=1 while do 1.check the file output,if the file output is N then keep on... (2 Replies)
Discussion started by: netdbaind
2 Replies

2. Shell Programming and Scripting

If condition to check null variable

Guys, Please help me on the below sample.cfg var=NULL sample.sh #!/bin/sh . /sample.cfg if ;then 1 st command here else 2 nd command here fi (3 Replies)
Discussion started by: AraR87
3 Replies

3. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

4. Shell Programming and Scripting

How to check existence of variable in csh

Hi All, I want to check existence of variable, whose name gets decided dynamically. E.g. value of this variable,is derived as $option_"exclude" , where value of option varies depending upon user input. I am trying to do it in a following way : set exclude_var = `echo $option"_exclude"`... (3 Replies)
Discussion started by: Rashmee
3 Replies

5. Shell Programming and Scripting

Check condition inside the loop

Hi, I am in trouble. I can get inside my condition test inside a loop : I am in ksh (solaris) while read file do <commande to retrieve file> >> ${LOG_RETRIEVE_FILE.log} msg_err=$(cat ${LOG_RETRIEVE_FILE.log} | grep "error retrieve") if ; then <sendmail> exit 1 fi done I tried... (6 Replies)
Discussion started by: Aswex
6 Replies

6. Shell Programming and Scripting

How to loop use while loop in csh script?

Hi all, i got 2 text file. file.txt value.txt i want use C shell script to write out while both of the file got different limit....how i going to write it in 1 while loop? (4 Replies)
Discussion started by: proghack
4 Replies

7. UNIX for Dummies Questions & Answers

csh, pattern matching in if() condition.

Hi: I am struggling to get the simplest pattern matching to work, in csh. In this line: if ("$MY" =~ /my/) echo match it seems that I just can not make it to match, even when $MY is "mymymy". Thanks. N.B Phil ---------- Post updated at 11:23 PM ---------- Previous update... (0 Replies)
Discussion started by: phil518
0 Replies

8. Shell Programming and Scripting

WHILE LOOP CONDITION CHECK

Hello I want to compare values of two variables as CHECK condition in a while loop. eg: var1=0 var2=10 while do echo " $var1 " var1=`expr $var1 + 1` done However this is giving error.How to do it in a proper manner? Thanks. (3 Replies)
Discussion started by: dashing201
3 Replies

9. Shell Programming and Scripting

using flag inside a for loop to check condition

I have a logic like this It initializes the flag variable as "T" at the beginning of the loop everytime Inside each loop it checks for two conditions and updates the flag variable as "A" or "B" In the end of the loop it checks for the value of the variable flag for "A" or "B" and execute... (4 Replies)
Discussion started by: codeman007
4 Replies

10. Shell Programming and Scripting

How to solve formate peroblem

I have converted an excel file in unix accessible form using Spreadsheet::ParseExcel. It coverting perfectly but the problem is while coverting there is one column in the excel sheet which is when coverted in unix it shows the value along with some extra value like : in excel sheet the value in... (0 Replies)
Discussion started by: akash
0 Replies
Login or Register to Ask a Question
DEBUG_ZVAL_DUMP(3)							 1							DEBUG_ZVAL_DUMP(3)

debug_zval_dump - Dumps a string representation of an internal zend value to output

SYNOPSIS
void debug_zval_dump (mixed $variable, [mixed $...]) DESCRIPTION
Dumps a string representation of an internal zend value to output. PARAMETERS
o $variable - The variable being evaluated. RETURN VALUES
No value is returned. EXAMPLES
Example #1 debug_zval_dump(3) example <?php $var1 = 'Hello World'; $var2 = ''; $var2 =& $var1; debug_zval_dump(&$var1); ?> The above example will output: &string(11) "Hello World" refcount(3) Note Beware the refcount The refcount value returned by this function is non-obvious in certain circumstances. For example, a developer might expect the above example to indicate a refcount of 2. The third reference is created when actually calling debug_zval_dump(3). This behavior is further compounded when a variable is not passed to debug_zval_dump(3) by reference. To illustrate, consider a slightly modified version of the above example: Example #2 <?php $var1 = 'Hello World'; $var2 = ''; $var2 =& $var1; debug_zval_dump($var1); // not passed by reference, this time ?> The above example will output: string(11) "Hello World" refcount(1) Why refcount(1)? Because a copy of $var1 is being made, when the function is called. This function becomes even more confusing when a variable with a refcount of 1 is passed (by copy/value): Example #3 <?php $var1 = 'Hello World'; debug_zval_dump($var1); ?> The above example will output: string(11) "Hello World" refcount(2) A refcount of 2, here, is extremely non-obvious. Especially considering the above examples. So what's happening? When a variable has a single reference (as did $var1 before it was used as an argument to debug_zval_dump(3)), PHP's engine opti- mizes the manner in which it is passed to a function. Internally, PHP treats $var1 like a reference (in that the refcount is increased for the scope of this function), with the caveat that if the passed reference happens to be written to, a copy is made, but only at the moment of writing. This is known as "copy on write." So, if debug_zval_dump(3) happened to write to its sole parameter (and it doesn't), then a copy would be made. Until then, the parameter remains a reference, causing the refcount to be incremented to 2 for the scope of the function call. SEE ALSO
var_dump(3), debug_backtrace(3), References Explained, References Explained (by Derick Rethans). PHP Documentation Group DEBUG_ZVAL_DUMP(3)