01-22-2009
division by 0 error
Hi,
I am writing a script that among other things will be checking for various files on mount points. One of the conditions is that unless the server has failed over the df command will show root ( / ). If when checking the files the script comes across /, I want it to skip it, otherwise to complete the printf statement.
This portion of the script is
if ${MNTD} == "/" then
> /dev/null
else
printf '%12 ......
When running, if the script comes across a / I am receiving a 'Division by 0' error and it will abort the query.
Any suggestions would be greatly appreciated.
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how can i show the value when i divide a number where the dividend is greater then the divisor. for example...
3 divided by 15 ---> let x=3/15
when i do this in the shell environment it gives me an output of 0.
please help me.
thanks. (3 Replies)
Discussion started by: inquirer
3 Replies
2. Shell Programming and Scripting
Hi ,
I have file :
after i run this command :
there are error
can we print blank line if output error ??
thanks.. ^^ (4 Replies)
Discussion started by: justbow
4 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I'm reasonably new to UNIX, and am having problems with a TSHELL script that I am using. The script is intended to cycle through a loop, and then divide the number in the counter by 10 and store the result in another variable. I am missing something simple here, but cannot work it out... (1 Reply)
Discussion started by: Col
1 Replies
4. Shell Programming and Scripting
How can I modify my awk code to get rid of the divion by zero error message? If I run the script without an input file, it should return error message "Input file missing" but not divison by zero.
Code:
#!/bin/nawk -f
BEGIN {
if (NR == 0)
{print "Input file... (4 Replies)
Discussion started by: Pauline mugisha
4 Replies
5. Shell Programming and Scripting
Hi,
I'm executing unixbench tool v4.1 on an embedded system and I'm getting these error messages:
Execl Throughput 1 2 3awk: /unixbench/unixbench-4.1.0/pgms/loops.awk:38: (FILENAME=- FNR=4) fatal: division by zero attempted
Pipe Throughput 1 2 3 4 5 6 7 8 9 10awk:... (3 Replies)
Discussion started by: rogelio
3 Replies
6. Shell Programming and Scripting
Hello,
I am searching for a way to calculate for example 10/100 within a shellscript and the result should be 0.1 and not just 0.
Every alternative i tried just results 0
Thank you in advance
2retti (6 Replies)
Discussion started by: 2retti
6 Replies
7. Shell Programming and Scripting
input
0 0 9820373 2069 0 0 11485482
awk '{print ($1/$3) / ($4/$7)}' input
error
Is there any way to fix this problem ? (25 Replies)
Discussion started by: quincyjones
25 Replies
8. UNIX for Dummies Questions & Answers
hi,
The below commands result only the whole number(not giving the decimal values).
pandeeswaran@ubuntu:~$ echo 1,2,3,4|sed 's/,/\//g'|bc
0
pandeeswaran@ubuntu:~$ echo 1000,2,3|sed 's/,/\//g'|bc
166
How to make it to return the decimal values?
Thanks (5 Replies)
Discussion started by: pandeesh
5 Replies
9. Shell Programming and Scripting
Hello,
How can I add a logic to awk to tell it to print 0 when encountering a division by zero attempted? Below is the code. Everything in the code works fine except the piece that I want to calculate read/write IO size. I take the kbr / rs and kbw / ws. There are times when the iostat data... (5 Replies)
Discussion started by: tommyd
5 Replies
10. Shell Programming and Scripting
I want to implement the below formula with awk oneliner
new_value = ((old_value - old_min) / (old_max - old_min) ) * (new_max - new_min) + new_min
I want to pass the value of old_min and old_min as variable. Here is what I did for this
old_min=$(awk 'BEGIN{a=100000000000}{if ($10<0+a) a=$10}... (2 Replies)
Discussion started by: sammy777888
2 Replies
LEARN ABOUT DEBIAN
storebackupmount
STOREBACKUPMOUNT(1) User Contributed Perl Documentation STOREBACKUPMOUNT(1)
NAME
storeBackupMount.pl - runs storeBackup backing up to an nfs mount
SYNOPSIS
storeBackupMount.pl -c configFile [-s server] [-l logFile] [-d]
[-p pathToStoreBackup] [-k killTime] [-m] mountPoints...
DESCRIPTION
This script does the following:
- checks an nfs server with ping
- mounts that server via a list of mount points
- starts storeBackup (with a config file)
- umounts that server
OPTIONS
--server, -s
name or ip address of the nfs server
default is localhost
--configFile, -c
configuration file for storeBackup.
if option 'logFile' is set in the configration file,
that log file is read online, if it is different from -l
--logFile, -l
logFile for this process.
default is STDOUT.
you can log into the same logfile as storeBackup
--debug, -d
generate some debug messages
--pathStbu, -p
path to storeBackup.pl
--killTime -k
time until storeBackup.pl will be killed.
default is 365 days.
the time range has to be specified in format 'dhms', e.g.
10d4h means 10 days and 4 hours
--keepExistingMounts, -m
if a mount already exists, do not umount after
running storeBackup
mountPoints
List of mount points needed to perform the backup.
This must be a list of paths which have to be
defined in /etc/fstab.
-
if you add 'ro,' or 'rw,' to the beginning of a mount
point, you can overwrite that option set in /etc/fstab
example:
ro,/filesSystemToRead
will mount /fileSystemToRead read only, even if the
corresponding entry in /etc/fstab mounts it read write
only root is allowed to use this feature!
EXIT STATUS
0 -> everything is ok
1 -> error from storeBackup
2 -> error from storeBackupMount
3 -> error from both programs
COPYRIGHT
Copyright (c) 2004-2008,2012 by Heinz-Josef Claes (see README). Published under the GNU General Public License v3 or any later version
perl v5.14.2 2012-03-03 STOREBACKUPMOUNT(1)