Sponsored Content
Top Forums Shell Programming and Scripting COMPARING STRING VALUES TO A VARIABLE and return code dignostics Post 302292558 by sieger007 on Saturday 28th of February 2009 03:45:51 PM
Old 02-28-2009
COMPARING STRING VALUES TO A VARIABLE and return code dignostics

Hey Folks and Gurus there
I am trying to replicate this logic in bash :



(1) if [ "$var" = Uppercase (this value list e.g."t1",'t2") ] ; then
function1 parameters &
function2 parameters &
fi

Is there an easy method esp one with regex that can do this comparision.
e.g. $var is compared to this list ( case regardless ) ( 'foo','foobar','cheese burger' )

(2) how can I express precedence of operation in an if statement .
e.g.
if [ ( expression1 -a expression2 -o expression3 ) -o (expression4 -a expression5) ]
well how do I convey this . Round brackets are not allowed.

(3) Finally if I have a situation. where I am calling a function in a function :

f1()
{ blan }

f2()
{blah
Conditional logic here
f1 variable & # St1
f1 variable & # St2

}

main flow statement
I want to check when St1 and St2 both have completed and when that happens ( whenever. Remember they run in parallel - with an & )
I want to shell to do something.
How should I replicate this logic .
Thanks in advance .
Bye
Sam
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing values of same variable

Hello all while writing a small script , i got stuck with this simple thing.Hope you guyz can help. Iam trying to read password echo"enter password" read $pwd now i have to check this echo"enter password to proceed" read $pwd now i have to check both the values of the... (2 Replies)
Discussion started by: coolkid
2 Replies

2. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

3. Shell Programming and Scripting

Return code of command assigned to variable

How do I evaluate the result of a command assigned to a variable?? Example: var1=`cmd` rc=$? rc will be the result of the assignment rather than cmd since it executes after. How do I evaluate the result of the command itself? Cheers..:confused: (2 Replies)
Discussion started by: browndr
2 Replies

4. Shell Programming and Scripting

Grep to return a code from accessing variable file name

All I want to do is find out if the string 'NO' is in a file by checking for a return code of 0 if there is a match. The grep works fine on the command line directly naming the file but I am obviously not using the correct syntax within the shell script as I consistently get the error message ... (5 Replies)
Discussion started by: SusanDAC
5 Replies

5. Shell Programming and Scripting

Comparing a variable to a string

Hi, I am trying to write a script to show the status of a Network card. Variables: chosennic is a read variable statuss=`/sbin/ifconfig $chosennic | grep MTU | awk '{print $1}'` ipadd=`/sbin/ifconfig $chosennic | grep Bcast | awk '{print $2}' | awk -F : '{print $2}'`... (2 Replies)
Discussion started by: mikejreading
2 Replies

6. Shell Programming and Scripting

Comparing files and capture return code

Hi, I would like to compare 2 files, and have a return code write to a file. regardless of the files contents are the same the code should be writing to a file (if both files contents are same then return code 0). A simple example will be great :) Thanks (3 Replies)
Discussion started by: khchong
3 Replies

7. UNIX for Dummies Questions & Answers

Comparing a String variable with a string literal in a Debian shell script

Hi All, I am trying to to compare a string variable with a string literal inside a loop but keep getting the ./testifstructure.sh: line 6: #!/bin/sh BOOK_LIST="BOOK1 BOOK2" for BOOK in ${BOOK_LIST} do if then echo '1' else echo '2' fi done Please use next... (1 Reply)
Discussion started by: daveu7
1 Replies

8. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

9. Shell Programming and Scripting

If a string variable value exists in a set of values

Can some one please help me with the syntax in shell script for the below : if $var1 exists in ('val1','val2','val3') I want to execute a set of commands if the value of var1 variable matches any one of the given string values. Please let me know if there are any other option to go by. ... (10 Replies)
Discussion started by: Pandee
10 Replies

10. Shell Programming and Scripting

Comparing the value of a string index to a variable.

Hi, coding a simple program to compare an entered number to a randomly generated one. The number of digits are restricted so I'm just trying to figure out how to refer to the index value in a string and then compare it to the variable I want. I don't know if bash automatically indexes strings, so... (7 Replies)
Discussion started by: outofcookies
7 Replies
DPM-REPLICATE(1)					    DPM Administrator Commands						  DPM-REPLICATE(1)

NAME
dpm-replicate - replicate a file given the SURL or the PFN SYNOPSIS
dpm-replicate [ --f_type file_type ] [ --space_token s_token ] [ --lifetime file_lifetime ] [ --help ] file DESCRIPTION
dpm-replicate replicates a file given the SURL or the PFN. file_type indicates the type of file desired for the new replica. It can be V (for Volatile), D (for Durable) or P (for Permanent). file_lifetime specifies the requested file lifetime of the new replica relative to the current time. It can be "Inf" (for infinite) or expressed in years (suffix 'y'), months (suffix 'm'), days (suffix 'd'), hours (suffix 'h') or seconds (no suffix). If specified the file_type and file_lifetime must be compatible. s_token specifies that the new replica should be allocated within a space identified by the given token. EXAMPLE
dpm-replicate --f_type P /dpm/cern.ch/home/dteam/afile dpm-replicate --f_type V lxb1921.cern.ch:/storage/dteam/2005-12-14/afile.38215.0 EXIT STATUS
This program returns 0 if the operation was successful or >0 if the operation failed. SEE ALSO
dpm(1), dpm_get(3), dpm_put(3) LCG
$Date: 2008/08/27 12:43:28 $ DPM-REPLICATE(1)
All times are GMT -4. The time now is 05:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy