let 'count = 1.2 * 100' error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting let 'count = 1.2 * 100' error
# 1  
Old 11-14-2007
let 'count = 1.2 * 100' error

I am trying to test some multiply function under bash shell, as you can see from the following

$ let 'count = 1.2 * 100'
bash: let: count = 1.2 * 100: syntax error in expression (error token is ".2 * 100")

does not work, seems bash shell does not like ".2"

$ let 'count = 1 * 100'

without .2, accepted,

So my question is, how can i let bash shell do the 1.2 * 100?

Thanks!Smilie
# 2  
Old 11-14-2007
Just about every shell I am familar with does not do floating point math. Integer only.

you can echo your formula into bc for the same result.

echo "1.2*100"|bc

returns
120
# 3  
Old 11-14-2007
ha, cool, it works and thanks a lot!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies

2. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

3. Shell Programming and Scripting

Getting Error count

Hi All, I have the below code. After doing copy and move if there is an error that should be initially captured as 1 and incremented for each error with exiting. Finally if the total error count to be greater than 2 then I need to exit the script. ######################## cp a/x.csv... (2 Replies)
Discussion started by: weknowd
2 Replies

4. Shell Programming and Scripting

Word Count error

I need to read a trigger file whose name can be: ABC!DEF@2014.txt or ABC!DEF@2014,2015.txt and then carry out functions on those inputs. Currently I am doing: YEAREXPORT { FILE= xyz.txt ls ABC* -l > ${FILE} if ; then log_err "Trigger File ABC* does not exist!" fi (4 Replies)
Discussion started by: rajiv_kool
4 Replies

5. Shell Programming and Scripting

Compare file1 header count with file2 line count

What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Discussion started by: pone2332
4 Replies

6. Shell Programming and Scripting

awk count how many IP have received that error

Hi all, I want to write a awk script that counts unique IPs that have received one special error. For example 25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS 25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23 30-04-2012;192.168.70.33;e;null;null;Failure... (4 Replies)
Discussion started by: arrals_vl
4 Replies

7. Shell Programming and Scripting

awk count how many unique IPs have received that error

Hi all, I want to write a awk script that counts unique IPs that have received one special error. For example 25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS 25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23 30-04-2012;192.168.70.33;e;null;null;Failure... (2 Replies)
Discussion started by: arrals_vl
2 Replies

8. Shell Programming and Scripting

count identical strings print last row and count

I have a sorted file like: Apple 3 Apple 5 Apple 8 Banana 2 Banana 3 Grape 31 Orange 7 Orange 13 I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found. so the output would look like: Apple 8 3 Banana... (2 Replies)
Discussion started by: dcfargo
2 Replies

9. Shell Programming and Scripting

Ignore error and get ls file count

I am trying to figure out how to run the below variable assignment in a shell script so that it will snuff the "no such file or directory" and just pass the count value. That way I can do a valid compare in the next step. num=`ls /appsrv/tmp/PrjRefData_20090428-*_in.xml | wc -l` ls:... (3 Replies)
Discussion started by: lynchmob
3 Replies

10. HP-UX

Count Exceeded Error on HP-UNIX

Sirs/Madame, On my HP-Unix, I came across an error GRECV-count exceeded and as a result of this, systems got hanged and server came down. Graceful shutdown too was not allowed. Kindly, Can anybody help me out in killing this issue Bhavani.R (0 Replies)
Discussion started by: bhavani2006
0 Replies
Login or Register to Ask a Question