I caught it before seeing your post and the error will still exist above 59.999 secs.
Even the minutes could be taken into account if required.
That is the OPs job...
Actually, it's not necessary to evaluate the minutes, only to see whether they are zero. If I would do it in the shell, I would therefore not do fixed substrings to extract the miliseconds, but something like - assuming that the line containing the desired value is in variable rtime -
and then use substrings to get rid of the period (or use zsh instead of bash, where you can work with decimal numbers).
would extract the part to the left of the 'm', but I would deal with the minutes using the regular expression feature of the shell.
This means, you have to do four steps with the output: Getting the line containing the real number (you used an array, but I would feel safer doing it by grep), testing that the minutes are 0, extracting the part for the miliseconds, and removing the dot so that you can do integer arithmetic. Of course it is a matter of taste, but this is the point where I tend to switch to a more flexible programming language.
I m not able to redirect the java version to a file however, it shows as output when I run my script.
bash-3.2$ more 1test.tmp
java_version=`which java`
echo "MY JAVA:"$java_version
version=`"$java_version" -version`
echo $version >>/tmp/moht/java_version.log
$java_version -version 2... (4 Replies)
I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000.
Command:
factor/factor 30000000-31000000
Sample output:
30999979 = 30999979
30999980 = 2^2 5 11 140909
30999981 = 3 10333327... (6 Replies)
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Hi,
I am unable to get beyond the exit function. The shell script is used to look for masked files and copy paste them to another location. Please refer to the code below for more information.
Thanks
Brinjit
#!/usr/bin/ksh... (10 Replies)
Code
set -x
STATUS="0"
echo $STATUS
for i in `ls -ltr Report*|awk '{ print $9 }'`
do
if
then
flg = "`head -1 "$i" |cut -c 31-33`"
echo `head -1 "$i" |cut -c 31-33`
echo $flg
if
then
echo "having Fun"
STATUS="2"
else
echo "no Fun"
fi
fi (2 Replies)
Hi,
I have a properties file that is read by the Unix Shell Script.
The script prompt the user to enter some input feilds and then based on user input it needs to look other values from properties file
Example
abc.properties file has following properties
Dev.DB2.name=someDEVDB2... (3 Replies)
I m executing ps command and sorting it according to memory usage.
Please find the output of the command.
# ps aux --sort pmem
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2060 624 ? Ss 01:54 0:00 init
root 2 0.0... (1 Reply)
Alright, here's the deal. I'm running the following ruby script (output follows):
>> /Users/name/bin/acweather.rb -z 54321 -o /Users/name/bin -c
Clouds AND Sun 57/33 - Mostly sunny and cool
I want to just grab the "57/33" portion, but that's it. I don't want any other portion of the line. I... (5 Replies)
I have a script on Linux that is using sfdisk to partition a usb drive.
I'm trying to redirectory the standard out and standard error which works, however, there is still messages being diplayed.
I guess it's kernel messages?
Is there a way to redirect this output?
Thanks (5 Replies)