check for param values


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting check for param values
# 1  
Old 03-18-2011
check for param values

I need to check for 4ht parameter values, if they are not in (17,18) in other words if they r not equal to 17 or 18 then exit.
can u help pls
# 2  
Old 03-18-2011
What is the parameter name ?
Is it in a variable ? (variable name ?)
Is it in a configuration file ? (configuration file name ?)

What code do you have ? what have you tried so far ?

Please give more clue
# 3  
Old 03-18-2011
I need to take the 4th parameter value and check in side the database get either 17 days back worth of data or 18 days of worht of data based on the parameter passed. if the parameter is passed anything other than 17 or 18 then it should exit

---------- Post updated at 02:03 PM ---------- Previous update was at 02:01 PM ----------

it stritaway passed to shell script from the command prompt like
AE RVSA PRD 17
# 4  
Old 03-18-2011
Code:
case "$4" in
1[78]) echo " value is ok" ;;
*) echo "Error : parameter number 4 should have the value 17 or 18" ;;
esac

Code:
case "$4" in
 1[78]) echo " value is ok" ;;
 *)  echo "Error : parameter number 4 should have the value 17 or 18" && exit 1 ;;
 esac

Code:
# set -- $(echo "AE RVSA PRD 17")
# case $4 in
> 1[78]) echo "OK" ;;
> *) echo "KO : script abort" && exit 1 ;;
> esac
OK

# 5  
Old 03-18-2011
thank you very much . you have been of greate help to me
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trying to use awk to check values and multiple

I am trying to use AWK to read a file, comma delimited, and check each field to see if it has a suffix of - (dash , minus sign) if so then I want to either move the minus sign the the beginning of the field or take the numeric portion of the field and multiply it by negative 1 to get the field... (9 Replies)
Discussion started by: ziggy6
9 Replies

2. Shell Programming and Scripting

Check increment values in column

Gents, I have a file where i would like to check the constant increment by 2 in column 2. 5450 1000 5450 1002 5450 1004 5450 1006 5465 1000 5465 1002 5465 1006 5465 1008 5550 1002 5550 1004 5550 1006 5550 1008 6830 1000 6830 1002 6830 1008 6830 1010 (6 Replies)
Discussion started by: jiam912
6 Replies

3. Red Hat

How to check values stored in variable?

hey, i have stored values of query like this val_2=$( sqlplus -s rte/rted1@rel75d1 << EOF set heading off select source_id from cvt_istats where istat_id > $val_1; exit EOF ) echo $val_2 now , val_2 has five values displayed like this 1 2 3 4 5 what i have to do is to check the... (1 Reply)
Discussion started by: ramsavi
1 Replies

4. Red Hat

How to check for values in array?

i stored some values in array , then i traverse through the array and check for some values and if they exist then echo success. let us consider that in our array we stored values from an sql query like this #!/bin/bash declare -a arr arr=$( sqlplus -s rte/rted2@rel76d2 << EOF set... (1 Reply)
Discussion started by: ramsavi
1 Replies

5. Shell Programming and Scripting

Check for null values in columns

Hi , I have below data with fixed with of 52 bytes having three columns value data. 01930 MA GLOUCESTER 02033 02025 COHASSET 01960 MA ... (3 Replies)
Discussion started by: sonu_pal
3 Replies

6. Solaris

check the utilization of kernel values ?

Any native Solaris commands/scripts to check the utilization of kernel tables/limits in Solaris ? (like equivalent command in HPUX is kcusage) (2 Replies)
Discussion started by: thamurali
2 Replies

7. Shell Programming and Scripting

Check values in file

Hi, I have a tab delimited file in which first row is the header and others rows has the values. A B C D 2 4 0.00 3.00 0.00 9.78 4654 898 I have to check whether all the values are zero. A B C D 0.00 0 0.00 0.00 0.00 0.00 0 0.000 Send mail if all the values in file are zero (4 Replies)
Discussion started by: sandy1028
4 Replies

8. Shell Programming and Scripting

How to check if the file contains only numeric values

How to check if the file contains only numeric values. I don't want to read entire file it eats lot of cpu Or any way which consumes less memory n cpu.. Please suggest -S (2 Replies)
Discussion started by: sunilmenhdiratt
2 Replies

9. Shell Programming and Scripting

how to check the variable values is blank

HI , I have to check the values of variable is blank or not. exm : ###test test1 var=`cate filename | head -1 | cut -c1-3` I need to check the first three character of 1st line . if it is blank .then exit or we need to process . Thanks in advance . (2 Replies)
Discussion started by: julirani
2 Replies

10. Shell Programming and Scripting

sed question - replacing param values

Hello, Do you have any idea why the below sed command is also replacing the value of "PARAMETER2" instead of just "PARAMETER" in file1 ? % parameter=PARAMETER % new_value=2 % cat file1 PARAMETER=1 PARAMETER2=1 % cat file1 | sed s/*$/${new_value}/1 PARAMETER=2 PARAMETER2=2 Thanks. (3 Replies)
Discussion started by: majormark
3 Replies
Login or Register to Ask a Question