Search Results

Search: Posts Made By: gsatch
6,838
Posted By gsatch
Thanks for the reply cbkihong. I've only started...
Thanks for the reply cbkihong. I've only started with perl about 4 months ago and haven't done much calling of one script from another, and even less of what I'm trying to do, which is basically...
6,838
Posted By gsatch
perl - variable inheritance
Hey Everyone,

Does anyone know how - or if it's even possible - for a child perl script to inherit the variables of a parent perl script? In a shell script, you would use "export" for example. I...
4,320
Posted By gsatch
Vaibhav, Try this instead: open...
Vaibhav,

Try this instead:

open (MAIL,"|mailx -s <subject> <email addresses>");
print MAIL "Mail line 1\n";
print MAIL "Mail line 2\n";
...
close (MAIL);

Greg
3,118
Posted By gsatch
Specifically, look at: strftime("%x",...
Specifically, look at:

strftime("%x", localtime(time))
where "%x" can be any of the usual formats supplied to the standard `date` command.

HTH
17,065
Posted By gsatch
for some reason i'm not getting notified of...
for some reason i'm not getting notified of updates to this thread so I just found this ...

cbkihong - looks to be EXACTLY what I'm looking for! I've done some simple testing and it's doing what...
17,065
Posted By gsatch
Thanks for the reply, Keith. The 'trap' in KSH...
Thanks for the reply, Keith. The 'trap' in KSH allows a section of code to be ran everytime the script exits (the exception may be when it's killed via "kill -9"), allowing for the script to...
17,065
Posted By gsatch
PERL: Trapping EXIT
Hey Everyone,

Just starting with PERL (5.8.2) after years of KSH. Is there a way to trap the exit as you can in KSH (i.e., "trap EXIT_SCRIPT EXIT")?

Thanks in advance for any help,
gsatch
28,694
Posted By gsatch
You're close. Try: cat <file> |while read...
You're close. Try:

cat <file> |while read LINE
do
if [ "`echo ${LINE} |grep '.txt'$`" != "" ] ; then
FILENAME=${LINE}
continue
fi
echo ${LINE} >> ${FILENAME}
done
9,351
Posted By gsatch
I've got a few UNIX servers (HP-UX) here. After...
I've got a few UNIX servers (HP-UX) here. After doing some "this server vs. that server" testing, I narrowed it down to being a patching problem. Applying the HP patch PHCO-27418, which is a...
9,351
Posted By gsatch
ksh script: 'exit' being treated as 'break 2'
hi,

in a korn shell script, has anyone ever seen an 'exit' being treated as a 'break 2'? I have a script which has 3 nested loops. Within the inner most loop, i'm trying to exit the script on a...
38,438
Posted By gsatch
Perderabo, you da the man!! (of course, making a...
Perderabo, you da the man!! (of course, making a gender assumption there). That worked beautifully!! Question for you as this is the 1st time I've come accross file descriptor 3 - 1 is STDOUT, 2...
38,438
Posted By gsatch
'tee' STDERR output (ksh)
Hi everyone,

KSH question: I know you can 'tee' STDOUT to have the output go to multiple targets; can you do the same with STDERR?

For example:

ls |tee /tmp/file.txt

Will redirect...
3,086
Posted By gsatch
try: rsh <client> '<script>;echo $?' ...
try:

rsh <client> '<script>;echo $?'

Note the single quotes as they cause the string to be sent in entirety to the client; without them, the 'echo' statement will end up running on the local...
6,000
Posted By gsatch
Try adding the line: IFS="" to...
Try adding the line:

IFS=""

to your script. This will reset the International Field Seperator such that it will no longer include blanks. I tried this here and it worked fine.
38,009
Posted By gsatch
BREAKTHRU!! Duh GSATCH, use "scale" option in...
BREAKTHRU!! Duh GSATCH, use "scale" option in `bc` - `echo "scale=2;2/3" |bc` returns ".66".

Ok, my brain is back in place now...
38,009
Posted By gsatch
Floating Point Division
Does anyone have a simple way of doing floating point ("fp") division? For example, if I divide 3 by 5, I can get 0.6. The built-in calc (`bc`) will perform fp multiplication, but not division, at...
4,251
Posted By gsatch
'eval' is a built-in command in the borne, korn...
'eval' is a built-in command in the borne, korn and c shells. Basically, it evaluates and executes whatever follows it as a command. In my example, '$a' is replaced by it's contents, or "b" so that...
4,251
Posted By gsatch
If I'm understanding this correctly, try this: ...
If I'm understanding this correctly, try this:

# b="this is a test"
# a="b"
# eval echo \$$a
this is a test
27,134
Posted By gsatch
Thanks for the reply. I do appreciate the input....
Thanks for the reply. I do appreciate the input. One problem with the code though - trying sourcing the script and you'll get the directory you sourced the script from and not the directory the...
27,134
Posted By gsatch
That - it's impossible - is what I've been afraid...
That - it's impossible - is what I've been afraid of. And am surprised about - I really thought I'd find something. I have made something work up to this point using a combination of ${PWD} and...
27,134
Posted By gsatch
Determining absolute PATH within KSH script
Hey everyone,

I'd like to determine the absolute path of where a script resides from within the same script. For example, I have a script - /tmp/myscript. Regardless of how that script is call -...
Showing results 1 to 21 of 21

 
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy