11-25-2009
Thxs Lakris, this is exactly what I want to do. The eval cd '$'$1 works like a champ. How can I set it to an unix var. Example:
ora_base_dir=eval cd '$'$1
I know the above does not work; but that is what I like to do.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date.
everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file.
... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies
2. AIX
I would like to run a compress script on files in certain directories.
My compress_script.sh is just basically
compress file*
In order for me to use this I have to copy it into each directory and run it.
How can I state the directory on the command line with the compress script so it... (2 Replies)
Discussion started by: NycUnxer
2 Replies
3. SCO
OS SCO Open Server 6.0 MP4
I am trying to change the value of a enviornment variable thru a script and want to pass a parameter on the commande line, If I hard code the value inside the script the script changes the enviornment variable
. mytest
where my test is
MYVAR=$1
export MYVAR... (6 Replies)
Discussion started by: atish0
6 Replies
4. Shell Programming and Scripting
Hi,
I have one shell script which use two parameter however one of its parameter have space in between.
eg.
a.sh 20110114 b c d
here b c d is one parameter
I used 'b c d' but its not giving correct result.
Also i tried b\c\d but this one also didnt work.
Any help would be... (5 Replies)
Discussion started by: diehard
5 Replies
5. Shell Programming and Scripting
Hi All,
i've a shell script, where it will run in the background, i'm using.
system("sh $Home/S_SCRIPT/cck.sh $shell_dum_file &");
i'm passing a parameter $shel_dum_file to the background process.
In shell script , i'm using.
#!/bin/sh
FILE=$1
echo "FILE NAME- $FILE"
this shell... (2 Replies)
Discussion started by: asak
2 Replies
6. Shell Programming and Scripting
Hi,
I have a function which connects to the db and runs the sql.
it works fine when I run it like: function "select empname from emp;"
but when I try to pass the sql string to a variable which in turn in fed to the function , it throws error.
please advise.
Thanks,
Arnie. (1 Reply)
Discussion started by: itsarnie
1 Replies
7. Shell Programming and Scripting
Hi All,
I'm new to Linux and scripting, apologies in advance for 'stupid' questions.
Please help... Im writing a script that calls a sqlplus script but the sqlplus requires inputs and i cant seem to get this to work.
here is my code.
#!/bin/sh
TERM=vt100
export TERM... (4 Replies)
Discussion started by: Mahomed
4 Replies
8. Shell Programming and Scripting
Hello All,
I am trying below
+++++++++
#/bin/bash
set -x
Host=$1
Port=$2
User=$3
Pass=$4
Warning=$5
Critical=$6
SCRIPT_LOC=/opt/agent/
Parameters="'""hostname=$Host&""port=$Port&""username=$User&""password=$Pass&""jvm=UsedMemory,$Warning,$Critical""'"
echo $Parameters... (10 Replies)
Discussion started by: sundari127
10 Replies
9. Shell Programming and Scripting
Good afternoon, i need your help pls
I want to write a new script that start running as soon as a previus one finish via Autosys (it should be implemented via Autosys too to validate the exsitance and the successful transfered file to a remote server
Whenever the file arrives to the path... (2 Replies)
Discussion started by: alexcol
2 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I have researched and tried many way to pass OUT parameter to be stored in variable in KSH Script.Still not success, please help.
Here is my Store Procedure.
create procedure testout3(v_in varchar2,v_out OUT integer)
as
begin
v_out := 1;
end;
Here is my testvout.ksh
#!/bin/ksh... (1 Reply)
Discussion started by: palita2601
1 Replies
LEARN ABOUT CENTOS
perl::critic::policy::errorhandling::requirecheckingreturnvalueo
Perl::Critic::Policy::ErrorHandling::RequireCheckingRetuUserlContributed PPerl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval(3)
NAME
Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval - You can't depend upon the value of "$@"/"$EVAL_ERROR" to tell
whether an "eval" failed.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
A common idiom in perl for dealing with possible errors is to use "eval" followed by a check of $@/$EVAL_ERROR:
eval {
...
};
if ($EVAL_ERROR) {
...
}
There's a problem with this: the value of $EVAL_ERROR can change between the end of the "eval" and the "if" statement. The issue is object
destructors:
package Foo;
...
sub DESTROY {
...
eval { ... };
...
}
package main;
eval {
my $foo = Foo->new();
...
};
if ($EVAL_ERROR) {
...
}
Assuming there are no other references to $foo created, when the "eval" block in "main" is exited, "Foo::DESTROY()" will be invoked,
regardless of whether the "eval" finished normally or not. If the "eval" in "main" fails, but the "eval" in "Foo::DESTROY()" succeeds,
then $EVAL_ERROR will be empty by the time that the "if" is executed. Additional issues arise if you depend upon the exact contents of
$EVAL_ERROR and both "eval"s fail, because the messages from both will be concatenated.
Even if there isn't an "eval" directly in the "DESTROY()" method code, it may invoke code that does use "eval" or otherwise affects
$EVAL_ERROR.
The solution is to ensure that, upon normal exit, an "eval" returns a true value and to test that value:
# Constructors are no problem.
my $object = eval { Class->new() };
# To cover the possiblity that an operation may correctly return a
# false value, end the block with "1":
if ( eval { something(); 1 } ) {
...
}
eval {
...
1;
}
or do {
# Error handling here
};
Unfortunately, you can't use the "defined" function to test the result; "eval" returns an empty string on failure.
Various modules have been written to take some of the pain out of properly localizing and checking $@/$EVAL_ERROR. For example:
use Try::Tiny;
try {
...
} catch {
# Error handling here;
# The exception is in $_/$ARG, not $@/$EVAL_ERROR.
}; # Note semicolon.
"But we don't use DESTROY() anywhere in our code!" you say. That may be the case, but do any of the third-party modules you use have them?
What about any you may use in the future or updated versions of the ones you already use?
CONFIGURATION
This Policy is not configurable except for the standard options.
SEE ALSO
See thread on perl5-porters starting here: <http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-06/msg00537.html>.
For a nice, easy, non-magical way of properly handling exceptions, see Try::Tiny.
AUTHOR
Elliot Shank "<perl@galumph.com>"
COPYRIGHT
Copyright (c) 2008-2011 Elliot Shank.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-0Perl::Critic::Policy::ErrorHandling::RequireCheckingReturnValueOfEval(3)