Hello,
Can anyone help with pearl Scripting.
I'm looking for equilant pearl code which can do -
OS=`uname -s`
if [[ $OS = "Linux" ]]; then
my $HOME='/home/mqm'
else
my $HOME='/export/home/mqm'
fi
thanks
Hello,
Can anyone help with pearl Scripting.
I'm looking for equilant pearl code which can do -
OS=`uname -s`
if [[ $OS = "Linux" ]]; then
my $HOME='/home/mqm'
else
my $HOME='/export/home/mqm'
fi
thanks
#!/usr/bin/perl
use strict;
use warnings;
my $os = $^O;
my $HOME = "";
if($os eq "Linux")
{
$HOME = "/home/mqm";
}
else
{
$HOME = "/export/home/mqm";
}
thanks for the reply.
i added the code to the existing perl script and ran it on Linux Server.
For some reason it is trying to find a folder under - /export/home/mqm, that means the $HOME was set for a non Linux server, even though i ran it on a linux server. So it seems it is not finding the right OS
Error:
find: /export/home/mqm/backup: No such file or directory
Part of the script which i changed:
#!/usr/bin/perl -w
use Shell qw(date);
use strict;
my $version = '0.4';
my (
$BUDir,
$ext,
$current_date,
$file_name,
$mq_bin_dir, # directory where mq binaries are located
$mq_tools_dir, # directory where mq tools are located
$mq_save_auths_dir, # directory to save files
$mq_save_qmgr_dir,
$qmgr_list, # hashref to qmgr info - returned from get_qmgr_list()
$qmgr_name, # name of queue mgr - used in loop
@bin_dirs, # list of places to look for mq binaries
);
#my $HOME=$ENV{'HOME'};
#my $HOME='/home/mqm';
my $os = $^O;
my $HOME = "";
if($os eq "Linux")
{
$HOME = "/home/mqm";
}
else
{
$HOME = "/export/home/mqm";
}
Change Linux
to all lower case linux
if($os eq "linux")
Thank you so much. it worked.