Running the md5 function from the ksh terminal does not matching the output from a simple Perl script.
In the terminal I run:
echo -n abc | md5
62fecf21103616856d72e6ffc9bcb06b
If I run it using Perl:
use Digest::MD5 qw(md5_hex);
foreach (@ARGV) {
print "Digest is ", md5_hex($_), "\n";
}
exit
I get
./perl_test.sh abc
Digest ...
Is there a way to set the debug mode(set -x) on a KornShell script globally? Currently it seems I have do something like the following:
a(){
set -x
#commands
}
b(){
set -x
#more commands
}
set-x
a
#commands
b
I would really like to only have to call the set-x command in one place.
Note: This is all in KSH88 on AIX.
E...
I would like to create a pipe in a ksh script (using exec) that pipe's to a tee, and sends the output to a pipe.
Current:
#Redirect EVERYTHING
exec 3>&1 #Save STDOUT as 3
exec 4>&2 #Save STDERR as 4
exec 1>${Log} #Redirect STDOUT to a log
exec 2>&1 #Redirect STDERR to STDOUT
What'd I'd like to do (but I don't have the syntax correct)...
I currently have a script that ssh's into another server and runs a command. When the ssh command runs though in prompts if I would like to connect (yes/no) and for the password. Is there a way that when the ssh call is made that I could automatically supply the input for the prompt?
Also, I do realize that using a public key with the...
Hi.
I'm stuck with the following:
I have a SQL query in a ksh and for the values like 0.23, 0.55 it displays only .23 .55.
Anyone have a idea ? There is some parameters to set ?
Thanks alot.
C.C.
...
Is there any way to automate the user input in a ksh script?
I realize that in many instances you can create an expect script to do exactly what I am saying, but expect is not installed on the server and there is no chance of that occurring in the near future. But I still need a method of automating user input so the only reaction requ...
i have a command to kill some processes as below:
kill -9 `psu|grep MF1pp|grep -v grep|awk '{print $2}'`
the command works perfectly fine
>psu|grep MF1pp|grep -v grep|awk '{print $2}'
29390
29026
$>kill -9 `psu|grep MF1pp|grep -v grep|awk '{print $2}'`
$>psu|grep MF1pp|grep -v grep|awk '{print $2}'
when i create an alias as below a...
Ok, so I need to translate a script from a nice linux & bash configuration to ksh in hp-ux. Each and every command expects a different syntax and i want to kill myself. But let's skip the rant.
This is part of my script
anterior=`date +"%Y%0m" -d '1 month ago'`
I basically need to get a past date in format 201002. Never mind the thin...
Is there a less brute-force way to do this?
#!/bin/ksh
THIS_SCRIPT=$(/usr/bin/readlink -f $(echo $0 | /bin/sed "s,^[^/],$PWD/&,"))
echo $THIS_SCRIPT
I'm stuck using ksh but would prefer a solution that works in bash too (which I think this does).
...
Why doesn't this work???
#!/bin/ksh
# array testfunc()
function testfunc {
typeset -A env
env=( one="motherload" )
print -r $env
return 0
}
testfunc # returns: ( one=motherload )
typeset -A testvar # segfaults on linux, memfaults on solaris
testvar=$(testfunc) # segfaults on linux, memfaults on solaris
print $...
What is the difference between the following two commands, when run on AIX?
/bin/sh 'ls -l -R'
/bin/sh -c 'ls -l -R'
...
I'm trying to remove the carriage returns (\r) from a file with the following command on AIX, but it's also removing my last line. Any suggestions?
sed -e 's/\r\n/\n/g' ./excprule > ./excprule.tst
Command sequence:
dev1:> sed -e 's/\r\n/\n/g' ./test_file > ./test_file.tst
dev1:> diff test_file.tst test_file
diff: 0653-827 Missing n...
Hi guys.
I'm working on a small piece of ksh code for a simple task.
I need to retrieve about 14 millions lines from a table and then generate a xml file using this informations. I don't have any treatement on the information, only some "IF".
The problem is that for writing the file it takes about 30 minutes, and it is not acceptable fo...
I am trying to catch the string cd /a/b/c and do the following conversion
(as part of a larger Perl program).
If cd /a/b/c exists then convert cd /a/b/c chdir '/a/b/c' and execute chdir '/a/b/c'
I can do the conversion; I can't tell perl to execute my command.
...
market_l="${echo $1 | awk '{print tolower($0)}'}"
echo $market_l
when i execute this its giving me an error below:
./test: market_l="${echo $1 | awk '{print tolower($0)}'}": The specified substitution is not valid for this command.
...
Hi.
I'm working on a pl sql stored procedure.
What I need is to do a select, use a cursor and for every record build a string using values.
At the end I need to write this into a file.
I try to use dbms_output.put_line("toto") but the buffer size is to small because I have about 14 millions lines.
I call my procedure from a unix ksh.
I...
Our ksh environment defines several functions. The names of these functions can be listed using then typeset -f ksh command (or the functions alias). Is it possible to see the definition (ie source code) for these functions?
This seems like an obvious question, but I've tried all manner of parameters to typeset -f with no luck.
As an...
Can anyone enlighten me why the following won't work?
$ groups
staff btgroup
$ ls -l
total 64
-rw-rw---- 1 sld248 btgroup 26840 Apr 02 13:39 padaddwip.jks
-rwxrwx--- 1 sld248 btgroup 1324 Apr 02 13:39 padaddwip.ksh
$ ./padaddwip.ksh
ksh: ./padaddwip.ksh: not found.
$ echo $?
127
This is nearly ident...
I have a script where I do not want it to call 'exit' if it's being sourced. Initially I though checking if $0 == bash but this has problems if the script is sourced from another script, or if the user sources it from ksh. Is there a reliable way of detecting if a script is being sourced?
...
I want to compare the a list of files in two directories quickly. I can use the following
$ ls /opt/myapp/ >> ~/myapplist
$ cksum ~/myapplist
3476215496 7657 /u/compll07/ojblass/myapplist
$ ls /opt/myapp2/ >> ~/myapp2list
$ cksum ~/myapp2list
3476215496 7657 /u/compll07/ojblass/myapp2list
And compare the ...