help with script parameter checking based on environment
I need to check if the parameters are correctly passed based on the Environment I am in.
For e.g when I am in dev the 1st paramter needs to be either A OR B OR C OR D
similarly when I am in qa the parameter needs to be either e or f
so i need to write a case staement or a if statement to acheive this
I wrote a case statement as below. SIEBELENV is an environment variable from the .profile
I have set the paths correctly based on the enviroment. but I need to make sure when the script runs in dev with a parameter equal to any of the FTP paths set for dev from case statment then only proceed
otherwise send an mail saying wrong parameters based on environment.
for e.g script would be called like this interface.ksh A g4 ( A is the SERVER_PATH ). I need to see if this is running in dev it should accept only either A or B orc or D
Otherwise throw an error that environment and paramter doesn't match
How can I do this
Last edited by Corona688; 04-17-2012 at 03:29 PM..
Hi Guys,
I am having a script which needs to be iterated based on date passed and itrate based on no of months given.
#!/bin/bash
var_d=$1
months=$2
sh invoke_script var_d
i need to iterate the inside script something like below
sh invoke_script 170101
sh invoke_script... (4 Replies)
Any good way to check if code has the required output
# /sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts
net.ipv4.icmp_echo_ignore_broadcasts = 1
/sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts | grep "= 1"
net.ipv4.icmp_echo_ignore_broadcasts = 1
What I can think of is above, and it... (16 Replies)
Hi.
How do I achieve this
sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt
The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this
sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
Hi All,
How do i get the last date of a month in Unix based on a parameter value.
My requirement is if i pass 03/05/2014 as parameter, then i shud get the output/return value as 2/28/2014
If i pass 03/31/2014 as parameter, the output/return value should be 03/31/2014 itself.
Also,... (2 Replies)
i am passing input parameter 'one_two' to the script , the script output should display the result as below
one_1two
one_2two
one_3two
if
then
echo " Usage : <$0> <DATABASE> "
exit 0
else
for DB in 1 2 3
do
DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}`
done
fi (5 Replies)
Hi,
I have a file with 6 columns. I want to check if column 1 and 2 fall between column 5 and 6 I want to call them as "TRUE_genes" if not then call them as "FALSE_genes". I can do it for checking one column but how to mention about two columns.
file1
110371373... (1 Reply)
Hi,
I needed to run a script based on the environment..I'm just having some issue with the script..can someone help me ?
#!/bin/ksh
pat01=`uname -a | awk '{printf "%s", $2}'`
#if it is server 1 run this file
if ; then
echo "run this file"
#if it is server 2 run this file... (5 Replies)
I have written a function that fills an array and another function where if a parameter is supplied it will jump to that part of the array and cat it to the screen.
I need to put in some checks to make sure the parameter supplied is firstly a number and then not a number great than the length of... (2 Replies)
Hi,
I will pass 3 parameters for a script.I have to check the file name and create a new file name with time stamp.
the parameters which i'm passing are
/dir/stg/filename.txt
/dir/path/head.txt
/dir/path/tail.txt
Now i have to check filename like :
if it is a.txt i have to create... (2 Replies)
Hi all,
My script has 2 mandatory and 1 optional paramter. If the third parameter(optional) one is null the it should take a default value say 3. Can any one please write a simple code.
sh test.sh 1 2 3
var1=$1
var2=$2
if
then
var3=3
fi
echo " the third variable $var3"
... (1 Reply)