I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
Discussion started by: Tirmazi
5 Replies
3. Post Here to Contact Site Administrators and Moderators
page
unix com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
Date Arithmetic with the Shell
has link of
www samag com/documents/s=8284/sam0307b/0307b.htm
which is no longer.
Is this the correct place to post this?:confused:
and I got message... (1 Reply)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (1 Reply)
Hello everybody,
I decided to take a Unix Introduction class and have never had experience with programming. Everything was fine until recently when the Prof. started shell scripting and he wants us to make a small script to add unlimited numbers from arguments and from standard input.
I... (8 Replies)
I need help on arithmetic
root@server # hour=`date | awk {'print $4'} | cut -d: -f 1`; echo $hour
04
Now I subtract this result by 1 or 01 I get "3" as the answer. I need "03" as the answer, ie last two significant numbers should be there.
root@server # hour=`date | awk {'print $4'} | cut... (3 Replies)
Hi,
I need a help with arithmetic calculations in my script. I have two variables: a=17; b=1712
I want to perform ($a/$b)*100 with two decimals in the result.
I tried with following:
res=$((100*a/b))
res=`echo "scale=2; $a / $b" | bc`
But I am not getting the decimal values.... (4 Replies)
I am trying to perform arithmetric, for example, to increment the value of variable $a (say 3) by 0.05 but when I tried the following expression
let a=a+0.05
or a=$((a+0.05))
both returned
3.0499999999999998
I want to keep 2 decimal places so it returns 3.05 instead. (6 Replies)
i am having a varialbe a , which is input to my file
i want to multiply this input with value .43, and assign it to variable b.
i tried it as below:
#!/bin/sh
a=$1
b=`expr $1\*0.43`
echo b=$b
error : expr: non-integer argument
Please tell me , how to do this.
Thanks (10 Replies)
Hello,
I am having a problem when i execute following script on RHEL 6.4. Same script works fine on another machine where I have same version of RHEL and KSH.
Below is the rpm and RHEL version.
ossvm12(0)> rpm -qa | grep ksh
ksh-20100621-19.el6.x86_64
ossvm12(0)> cat... (7 Replies)
Discussion started by: Adithya Gokhale
7 Replies
LEARN ABOUT LINUX
putws
putws(3C) Standard C Library Functions putws(3C)NAME
putws - convert a string of Process Code characters to EUC characters
SYNOPSIS
#include <stdio.h>
#include <widec.h>
int putws(wchar_t *s);
DESCRIPTION
The putws() function converts the Process Code string (terminated by a (wchar_t)NULL) pointed to by s, to an Extended Unix Code (EUC)
string followed by a NEWLINE character, and writes it to the standard output stream stdout. It does not write the terminal null character.
RETURN VALUES
The putws() function returns the number of Process Code characters transformed and written. It returns EOF if it attempts to write to a
file that has not been opened for writing.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ferror(3C), fopen(3C), fread(3C), getws(3C), printf(3C), putwc(3C), attributes(5)SunOS 5.10 22 Apr 1997 putws(3C)