Can you ref/link/import a function from external ksh script?
Hey guys,
I'm not the best AIX scripter about but I can flounder my way thru them to create what I need.
Anyhow, I have various scripts that perform various actions and processes. I was tasked to come up with a single form of logging that all the scripts could implement so that the output would be uniform and easy for our monitoring system to parse and use and ends up like this:
Essentially I've mimicked log4j, easy enough.
However, rather than go back thru X number of scripts and cut & paste the entire function script I've written into each one, is it possible to simply 'import/reference/inherit' this function (script) into each of the other scripts with a single line?
I'm using ksh to do all this. True, each script that needs to use this logging function will need to implement the proper "log [-diwef] <msg>" calls but I'd rather they do that and all refer to a single script that contains the function than bulk up 10+ scripts with lines and lines of the same code.
I have googled for this but so far nothing comes up with "AIX ksh scripting importing external script" and various of it.
If you're using functions for your logging, you can import that file with '. <path/to/file>'
And I know it might be a bit late, but there is a Log4j variant for shell scripts, called Log4sh
I'm able to read & print an array in varaible called "filelist"
I need to pass this array variable to a function called verify() and then read and loop through the passed array inside the function.
Unfortunately it does not print the entire array from inside the funstion's loop.
#/bin/ksh... (5 Replies)
Can Someone please explain why BEGIN and END statement is used inside function? How does that help in scripting?
function fileformatting
{
CleanupMask="xXxX"
sed 's/^.//' < ${AllFile} > ${AllFile}.tmp
echo $(wc -l ${AllFile}.tmp)
`awk -v CleanupMask=${CleanupMask} '
BEGIN... (2 Replies)
my $sysdate = strftime('%Y-%m-%d', localtime );
biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals)
In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
Hi,
I have written a function which will blink a text "Scanning...". Now in the main script when I am doing the scan in the server I want to call this function so that user will see a blinking text on the screen and at the same time script will proceed will the scan function. Once scan is... (2 Replies)
hi guys, how r u???
please I need you, help me please.
I have a shell, in this shell i have this function and another code lines, this function is getting date one day back. the function is in the same shell (FILE 1)
Now I need put this function in another file (FILE 2) and calling... (4 Replies)
hello,
I am creating a HASH table using file1.pl :-
I want to retrieve the content of the hash table created above from another file named file2.pl :-
The problem is that if I separate like this into 2 files.Then it says that HASH table is not created.So can you please tell me how to... (2 Replies)
Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions
i would have a only single script file to declare my variables, like:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }... (2 Replies)
Hi all, I have a basic doubt. Is there any way to use external
functions (i.e. functions not defined in AWK), in AWK.
I have a shell script in which I'm using a AWK snippet. In this
snippet I'm calling a function defined in the shell script. But the AWK
snippet is not working. I figured that... (5 Replies)