What shell are you using for this? I tried this with sh, ksh and bash, and it worked with all three. I had to make one modification though:
Without the "./" it was giving a "./test.sh: test_common.lib: not found" error under sh and ksh.
As for the explanation of how the ". test_common.lib" line works, here's how:
When you run . test_common.lib, or in my case . ./test_common.lib, the statements in the test_common.lib file are processed inside the calling shell itself, unlike when you just run ./test_common.lib (this forks a seperate process). Because the calling shell processes these, any statements such as variable definitions, function definitions, etc are stored in the calling shell and are available for later use.
The line
. test_common.lib though executes successfully in the script, the get_info function is not able to execute as the definition for get_info is not made available.
When i ran . ./test_common.lib.
It's proceeding further by calling the function.
I am using bash scripting.
What shell are you using for this? I tried this with sh, ksh and bash, and it worked with all three. I had to make one modification though:
Without the "./" it was giving a "./test.sh: test_common.lib: not found" error under sh and ksh.
Works fine if "." is included in the PATH variable, for example :
Jean-Pierre.
I am still learning shell scripting. Recently I see a function for read configuration. But some of special character make me confused. I checked online to find answer. It was not successful. I post the code here to consult with expert or guru to get better understanding on these special characters... (3 Replies)
I have a file with two line, one is header, the other actual value:
TYPCD|ETID2|ETID|LEG ID|PTYP|PTYP SUB|TRD STATUS|CXL REASON|CACT|CACTNM|ENCD|ENC
D NM|TRDR|ASDT|TRDT|MTDT|STDT|LS|SECID|SECID TYP|SECNM|PAR|STCC|MARKET PRICE|DIS
MARKET PRICE|MARKET PRICE CURRENCY|SRC OF SETTLEMENT... (2 Replies)
Please let me know the meaning for the below statements in shell scripting.
1) exit -99
--------------------------------
2) set prgdir = `pwd`
set runFlag = runFlag:FALSE
-------------------------------------
3) if (-f $prgdir/maillst.eml) then
set distEmail = `cat $prgdir/maillst.eml`... (1 Reply)
Here is the famous line 2238 of Unix V6 which is part of some of the most delicate parts of the kernel, context switching.
This comment received huge publicity and just may be the the most famous source code comment in computing history.
2230 /*
2231 * If the new process paused because it... (0 Replies)
Can anyone explain me the meaning of line #2 in these lines of shell script:
if ; then
${EXPR} " ${MACTIONS
} " : ".* ${ACTION} " >/dev/null 2>&1 || die "$USAGE"
else
Sorry in case this is a trivial thing (I am not an expert in this). (3 Replies)
#!/bin/sh
$ORACLE_HOME/bin/sqlplus -S $orauserid/$orapasswd@$oradb << _TMP
alter session set nls_date_format = 'YYYYMMDD HH24:MI';
set linesize 100
set pagesize 400
ok the above is part of a script..i just wanna know what does sqlplus -S means?? as in why we need to insert the -S behind? (2 Replies)