Visit Our UNIX and Linux User Community

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


I have variables like


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

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

Thanks in advance

Previous Thread | Next Thread
Test Your Knowledge in Computers #822
Difficulty: Medium
In HTML5, both the strike and div elements were deprecated.
True or False?

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 #!/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 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


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
pthread_cond_signal(3T) 												   pthread_cond_signal(3T)

pthread_cond_signal(), pthread_cond_broadcast() - unblock one or all threads waiting on a condition variable SYNOPSIS
cond Pointer to the condition variable to be signaled or broadcast. DESCRIPTION
The function is used to wake-up one of the threads that are waiting for the occurrence of a condition associated with condition variable cond. If there are no threads blocked on cond, this function has no effect. If more than one thread is blocked on cond, the scheduling policy determines which thread is unblocked. It is possible that more than one thread can be unblocked due to a spurious wakeup. The function is used to wake-up all threads that are waiting for the occurrence of a condition associated with the condition variable cond. If there are no threads blocked on cond, this function has no effect. If more than one thread is blocked on cond, the scheduling policy determines the order in which threads are unblocked. The condition variabled denoted by cond must have been dynamically initialized by a call to or statically initialized with the macro An unblocked thread will reacquire the mutex it held when it started the condition wait before returning from or The threads that are unblocked contend for the mutex according to their scheduling policy and priority. The or functions can be called by a thread whether or not it currently owns the condition variable's associated mutex. For predictable scheduling behavior and to prevent lost wake-ups, the mutex should be held when signaling a condition variable. Usage When using condition variables, there is a boolean predicate associated with each condition wait. If this predicate is false, the thread should do a condition wait. Spurious wakeups may occur when waiting on a condition variable. Because the return values from and do not imply anything about the value of this predicate, the predicate should always be re-evaluated. Applications using condition variables typically acquire a mutex and enter a loop which checks the predicate. Depending on the value of the predicate, the thread either breaks out of the loop or waits on the condition. On return from the condition wait, the predicate is re- evaluated. RETURN VALUE
Upon successful completion, and return zero. Otherwise, an error number is returned to indicate the error (the variable is not set). ERRORS
For each of the following conditions, if the condition is detected, the and functions return the corresponding error number: [EINVAL] cond is not a valid condition variable. [EFAULT] cond parameter points to an illegal address. AUTHOR
and were derived from the IEEE POSIX P1003.1c standard. SEE ALSO
pthread_cond_init(3T), pthread_cond_wait(3T). STANDARDS CONFORMANCE
Pthread Library pthread_cond_signal(3T)

Featured Tech Videos