Sponsored Content
Top Forums Shell Programming and Scripting Execution problem on kornshell Post 302481090 by reachaysh on Thursday 16th of December 2010 03:47:09 PM
Old 12-16-2010
MySQL Execution problem on kornshell

HI,

Requirement: I need to pass space between argument value for the paramter "GPG_PUBLIC_UID" but whenever i use single quotes or double quotes while supplying value for the arguments to the script, i see the value of the field "GPG_PUBLIC_UID" is getting splitted and my script fails to process with the actual value.
eg: i am trying to pass GPG_PUBLIC_UID= "ABCD DEFG" and my script splits them as GPG_PUBLIC_UID = "ABCD".

My script :
Code:
#!/bin/ksh
set -x
this=${0##*/};
params=$*
#--Read all parameters passed
for p in $params ;do
        eq=`echo $p|grep = >/dev/null 2>&1;echo $?`
        if [[ $eq -eq 0 ]]; then
                exc=`echo $p|egrep -e "SRC_DIR=|SRC_FILE=|TGT_DIR=|TGT_FILE=|MID_USER=|MID_HOST=|MID_DIR=|GPG_PUBLIC_UID=|REMOTE_USE
R=|REMOTE_HOST=|REMOTE_DIR=|TOUCH_FILE=">/dev/null 2>&1;echo $?`
                if [[ $exc -eq 0 ]]; then
                        name=`echo ${p%%=*}`
                        value=`echo ${p##*=}`
                        export $name=$value
                fi
        fi
done
#--As any required parameter missing check
echo "\nChecking if [[ -z ${SRC_DIR} ]] || [[ -z ${SRC_FILE} ]] || [[ -z ${TGT_DIR} ]] || [[ -z ${TGT_FILE} ]] || [[ -z ${MID_USER}
]] || [[ -z ${MID_HOST} ]] || [[ -z ${MID_DIR} ]] || [[ -z ${GPG_PUBLIC_UID} ]] || [[ -z ${REMOTE_USER} ]] || [[ -z ${REMOTE_HOST} ]
] || [[ -z ${REMOTE_DIR} ]] ||[[ -z ${TOUCH_FILE} ]]"
if [[ -z ${SRC_DIR} ]] || [[ -z ${SRC_FILE} ]] || [[ -z ${TGT_DIR} ]] || [[ -z ${TGT_FILE} ]] || [[ -z ${MID_USER} ]] || [[ -z ${MID
_HOST} ]] || [[ -z ${MID_DIR} ]] || [[ -z ${GPG_PUBLIC_UID} ]] || [[ -z ${REMOTE_USER} ]] || [[ -z ${REMOTE_HOST} ]] || [[ -z ${REMO
TE_DIR} ]] || [[ -z ${TOUCH_FILE} ]];
....
....

Pls guide me to proceed further.

Last edited by Scott; 12-16-2010 at 05:43 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in Connecting to Oracle Database using KornShell

Hello, I am very new to Scripting. I am having a Kornshell Script below for connecting to Oracle database. But getting an error while executing it. #!/bin/ksh ssh -X root@192.168.2.127 <perimuka> sleep 5 su - oracle sqlplus <mraghunandanan>/<peri123> <<eof Can anyone tell what is wrong... (3 Replies)
Discussion started by: mraghunandanan
3 Replies

2. UNIX for Dummies Questions & Answers

Problem with Crontab execution

Hi I have shell script to excute the SQL script.And i have scheduled those shell script in crontab.But the Shell script is not running timely and i got the below error Crontab entry 15 05 17 7 * /export/home/vcpsapp/vcps/stat.sh Output Your "cron" job on uspxivus16... (3 Replies)
Discussion started by: mak_boop
3 Replies

3. Shell Programming and Scripting

execution problem with grep

how to use grep word from sentence grep -o "hai" haighaihaihai Is above cmd possible in linux ? can any one help me? Thanks, (5 Replies)
Discussion started by: kavi.mogu
5 Replies

4. UNIX for Dummies Questions & Answers

execution problem

Hi i am using expect module and trying to login using following code. ssh 127.0.0.1 expect "word:" send "$password \n" kindly let me know the login script using expect module (1 Reply)
Discussion started by: esumiba
1 Replies

5. UNIX for Dummies Questions & Answers

execution problem

Hi i have a file in which there are three fields code: 919804199233 404911130003916 357266044991350F and now i want to add two more fields i.e. code: 919804199233 404911130003916 357266044991350F ms 123 how can i do it using command line and if have a file of 100... (8 Replies)
Discussion started by: esumiba
8 Replies

6. UNIX for Dummies Questions & Answers

execution problem

Hi I am automating my few commands out of which one command is tail -f running.logs when i run this command it does not automatically exit and show prompt (#) what would i do so that it will exit out automatically after few seconds and move to the next command without using ... (4 Replies)
Discussion started by: esumiba
4 Replies

7. UNIX for Dummies Questions & Answers

execution problem

HI I am trying to check the status of port using command /code: netstat -an | grep port /Output: *.2009 *.* 0 0 65535 0 LISTEN what i am trying to do is i want to grep only status Wether the port is established/listen if so show ok else... (1 Reply)
Discussion started by: esumiba
1 Replies

8. Shell Programming and Scripting

Execution problem

hi all, when i tried executing the script by giving following command $ sh test.sh <parameter> it shows the following output: <none> status code=0 Previously it was working fine.But now its showing this output. (1 Reply)
Discussion started by: sanjay mn
1 Replies

9. Shell Programming and Scripting

Execution problem

Hi, I have been trying to run a simple script CONFIG_FILE="/jay/check" . . . for i in `cat $CONFIG_FILE` do loc=`echo $i | cut -d "|" -f2` var=$(find $loc -mtime -1|wc -l) if then echo $loc has files older than 1 day fi done . . . (2 Replies)
Discussion started by: jayii
2 Replies

10. UNIX for Dummies Questions & Answers

Execution problem

How to search a pattern from multiple files... i used the command suppose the pattern name is xxx grep xxx (file1-o- file2-o- file3) Thanks in advance (4 Replies)
Discussion started by: ksakil
4 Replies
ECHO(3) 								 1								   ECHO(3)

echo - Output one or more strings

SYNOPSIS
void echo (string $arg1, [string $...]) DESCRIPTION
Outputs all parameters. echo is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo, the parameters must not be enclosed within parentheses. echo also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. Prior to PHP 5.4.0, this short syn- tax only works with the short_open_tag configuration setting enabled. I have <?=$foo?> foo. PARAMETERS
o $arg1 - The parameter to output. o $... - RETURN VALUES
No value is returned. EXAMPLES
Example #1 echo examples <?php echo "Hello World"; echo "This spans multiple lines. The newlines will be output as well"; echo "This spans multiple lines. The newlines will be output as well."; echo "Escaping characters is done "Like this"."; // You can use variables inside of an echo statement $foo = "foobar"; $bar = "barbaz"; echo "foo is $foo"; // foo is foobar // You can also use arrays $baz = array("value" => "foo"); echo "this is {$baz['value']} !"; // this is foo ! // Using single quotes will print the variable name, not the value echo 'foo is $foo'; // foo is $foo // If you are not using any other characters, you can just echo variables echo $foo; // foobar echo $foo,$bar; // foobarbarbaz // Some people prefer passing multiple parameters to echo over concatenation. echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10); echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . " "; echo <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon. no extra whitespace! END; // Because echo does not behave like a function, the following code is invalid. ($some_var) ? echo 'true' : echo 'false'; // However, the following examples will work: ($some_var) ? print 'true' : print 'false'; // print is also a construct, but // it behaves like a function, so // it may be used in this context. echo $some_var ? 'true': 'false'; // changing the statement around ?> NOTES
Note Because this is a language construct and not a function, it cannot be called using variable functions. SEE ALSO
print(3), printf(3), flush(3), Heredoc syntax. PHP Documentation Group ECHO(3)
All times are GMT -4. The time now is 10:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy