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
VAR_EXPORT(3)								 1							     VAR_EXPORT(3)

var_export - Outputs or returns a parsable string representation of a variable

SYNOPSIS
mixed var_export (mixed $expression, [bool $return = false]) DESCRIPTION
var_export(3) gets structured information about the given variable. It is similar to var_dump(3) with one exception: the returned represen- tation is valid PHP code. PARAMETERS
o $expression - The variable you want to export. o $return - If used and set to TRUE, var_export(3) will return the variable representation instead of outputting it. RETURN VALUES
Returns the variable representation when the $return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL. NOTES
Note When the $return parameter is used, this function uses internal output buffering so it cannot be used inside an ob_start(3) callback function. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.0 | | | | | | | Possibility to export classes and arrays con- | | | taining classes using the __set_state() magic | | | method. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 var_export(3) Examples <?php $a = array (1, 2, array ("a", "b", "c")); var_export($a); ?> The above example will output: array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) <?php $b = 3.1; $v = var_export($b, true); echo $v; ?> The above example will output: 3.1 Example #2 Exporting classes since PHP 5.1.0 <?php class A { public $var; } $a = new A; $a->var = 5; var_export($a); ?> The above example will output: A::__set_state(array( 'var' => 5, )) Example #3 Using __set_state() (since PHP 5.1.0) <?php class A { public $var1; public $var2; public static function __set_state($an_array) { $obj = new A; $obj->var1 = $an_array['var1']; $obj->var2 = $an_array['var2']; return $obj; } } $a = new A; $a->var1 = 5; $a->var2 = 'foo'; eval('$b = ' . var_export($a, true) . ';'); // $b = A::__set_state(array( // 'var1' => 5, // 'var2' => 'foo', // )); var_dump($b); ?> The above example will output: object(A)#2 (2) { ["var1"]=> int(5) ["var2"]=> string(3) "foo" } NOTES
Note Variables of type resource couldn't be exported by this function. Note var_export(3) does not handle circular references as it would be close to impossible to generate parsable PHP code for that. If you want to do something with the full representation of an array or object, use serialize(3). Warning When var_export(3) exports objects, the leading backslash is not included in the class name of namespaced classes for maximum com- patibility. SEE ALSO
print_r(3), serialize(3), var_dump(3). PHP Documentation Group VAR_EXPORT(3)