Simple Math question...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Simple Math question...
# 1  
Old 10-27-2006
Simple Math question...

Hi All ,

I'm trying to do a simple math expression ...but unsuccessfull :-(

Anyone can help me?

days=23
amount=`expr ${days} / 30 \* -125`
echo $amount

but as result i got 0 when i expect 95.833333

Another question...how i can limit only to two or three decimal fields?

Thanks in advance
# 2  
Old 10-27-2006
Searching the forums may have given you the answer faster. See Problem in division
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for solving the math question

Can such Puzzle solve through UNIX script? if yes, what could be the code? This has been solve in C language. we were trying to solve this through shell but could not because of not able to pass 1st argument with multiple value. we are not expert in unix scripting. Below is the puzzle John is a... (4 Replies)
Discussion started by: anshu ranjan
4 Replies

2. Shell Programming and Scripting

Bit of a math question

I have a number, say 174. I need to write bash code that will find the first larger number that ends in 99. That would be 199 in this case. If the number were 1263, I would be looking for 1299, for 175438, I would want 175499, etc. If the numbers were always three digit, I could just grab the... (11 Replies)
Discussion started by: LMHmedchem
11 Replies

3. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

4. Shell Programming and Scripting

Very simple question 2

Hey , another question is below: Administrator@fe038390aa60482 ~/Frank/20130509 $ c=`ls -ls` Administrator@fe038390aa60482 ~/Frank/20130509 $ echo $c Total 4 1 -rwxr--r-- 1 Administrator None 482 May 9 11:07 do_increment 1 -rwxr --r-- 1 Administrator None 272 May 9 11:32 do_square 1... (2 Replies)
Discussion started by: franksunnn
2 Replies

5. Shell Programming and Scripting

Doing simple math for children.

Hello! I saw that there were a few differente ways to do math within bash scripts. expr and bc are possibilities. But which one to use when? I want to make an simple bash script for children to do math. The script must ask only questions like 1*1= till 10*10= ... No + or - or /... (10 Replies)
Discussion started by: ugurgazi
10 Replies

6. Programming

Simple C question... Hopefully it's simple

Hello. I'm a complete newbie to C programming. I have a C program that wasn't written by me where I need to write some wrappers around it to automate and make it easier for a client to use. The problem is that the program accepts standard input to control the program... I'm hoping to find a simple... (6 Replies)
Discussion started by: Xeed
6 Replies

7. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies

8. UNIX for Dummies Questions & Answers

Hopefully simple question

When i type cd etc/shadow it says that file or directory doesnt exist? Is there a way to show this or am i typing something wrong? :confused: (6 Replies)
Discussion started by: Corrail
6 Replies

9. Shell Programming and Scripting

a math related question

hello: First I know the rules on Homework related questions, I wrote my script, but I cannot seem to figure out how to do one math problem. How do I take a zip code and seperate the idvidual digits? I used the modulus expression and divided the number by 10 ^ n but that only worked... (9 Replies)
Discussion started by: jahjah
9 Replies
Login or Register to Ask a Question