You do not need to do the filtering on the remote host. Just do the ps remotly and the rest locally :
num=`ssh userName@remoteBox 'ps -ef' | grep userName | grep -i processName | grep -v grep | awk '{print $2 }'`
--------------------
Denis
What are the values for @last4months[0..3] and $rpt_month ?
Could it be possible that $rpt_month equals one of the last4months ?
--------------------
Denis
You could try:
sed 's/^"//;s/"$//' | awk -F '"?,"?'
in the first example given by p5wizard.
The sed suppress any " at start or end of line and the -F in awk allowed for optional " before and after the comma.
This simple trick would not work if there is any comma or escaped quotes inside the...
No need to backquote the ls: you don't want the output of ls, just its exit code (ls returns an error if a file does not exist).
Just remove the standard and error outputs and check the return code (it's what if do):
if ls *.log >/dev/null 2>&1; then
: # Here at least one .log file exists...
Use eval !
The command export has an (unwanted) side effect: it exports the variables.
Besides, eval also allows you to get/use the values using constructed variable names:
eval echo \$CLIENT${COUNT}
--------------------
Denis
... unless you put a dash '-' just after the '<<'.
In this case all TABs (and only TABs) are stripped from the start of the following lines before they are used (either for checking against the 'EndOfHereDocument' string or as input for your command)
for arg in "$@"
do
ftp -n -i -v <<-SCRIPT...
If not for the speed problem you speak of in your other thread thread822-989438 (and I do not know if this is so much un issue), it could be so much simpler with tar.
You could directly use the fileList.txt
# backup
(cd /; tar cf - -T fileLst.txt) | (cd /backuploc; tar xf -)
# restore
(cd...
#!/usr/bin/perl -w
use warnings;
use strict;
use locale;
open FILE1, "file1.ans" or die;
open FILE2, "file2.ans" or die;
my %orig;
my %orig_from_lc;
my %to_be_used;
while (<FILE1>) {
chomp;
my ($orig, $punct)=split /\t/;
$orig{$orig}=$punct;
$orig_from_lc{lc $orig} = $orig...
Some reflexions about strcmp returning <0, =0, >0 instead of -1, 0, 1.
As Salem said: both results are consistent, yes. But looking for positive or negative instead of 1 and -1 is more generic and will be true for all implementations. When in doubt stick to the manual.
How many times did I...
There could be a limit on the length on the string that can be returned by a backquote commande or a limit on the length of a command (here the for i in command).
There could be non directory entry in dirX (simple files).
Also, there could be a problem if any subdirectory has 'special'...
I am off subject but I just want to add a little comment about this line:
($j,$j,$j,$j, $size, $j, $j, $j, $j) = split(" ", $_);
You do not need this useless variable $j.
You could just use the 5th field like this:
($size) = (split(" ", $_))[4];
The parentheses around $size used to force...
As you said, on msdos, the command date and time without arguments let you change the date and time. Each of them expected you (so waited for you) to enter a new date or time and to press return to validate. No surprise then.
--------------------
Denis
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.