Sponsored Content
Full Discussion: bash "not found" error
Top Forums Shell Programming and Scripting bash "not found" error Post 302634011 by methyl on Wednesday 2nd of May 2012 06:18:47 PM
Old 05-02-2012
Quote:
amt="`echo "scale=3;$numerator/$base*100" |bc |cut -d. -f1`"
There are too many double quotes on this line. You cannot nest double quotes. As it stands the whole meaning of the line becomes altered and the Shell tries to execute a string between the backticks.

Try this to remove the syntax issue caused by the excess quotes:
Code:
amt=`echo "scale=3;$numerator/$base*100" |bc |cut -d. -f1`

However this suggested revised version of the command would be mathematically correct and totally unambiguous:
Code:
amt=`echo "scale=3;(($numerator * 100) / $base)" | bc | cut -d. -f1`


Ps. I can't see anythng to stop this corrected command working from cron. Don't execute /etc/profile in your script - it will not help.

Last edited by methyl; 05-02-2012 at 07:46 PM.. Reason: typos and addenda
This User Gave Thanks to methyl For This Post:
 

9 More Discussions You Might Find Interesting

1. Red Hat

"No Drives Found" error during Redhat Linux AS 4 installation

I'm trying to install Redhat LInux AS 4 update 4 on an IBM x306 series server. I keep getting following error: "No Drives Found. An error has occurred - no valid devices were found on which to create new file systems. Please check your hardware for the cause of this problem." I called IBM and... (2 Replies)
Discussion started by: pieman8080
2 Replies

2. Shell Programming and Scripting

"-bash: sqlldr: command not found"

hi all, here i am trying to run one control file. but getting "-bash: sqlldr: command not found" error :confused: the code is given below. sqlldr $db_username/$db_password@$db_sid control=$loading_path/load_to_table.ctl log=loading.log can anybody help me in fixing the issue? ... (1 Reply)
Discussion started by: vinayakatj56
1 Replies

3. Post Here to Contact Site Administrators and Moderators

What's happens with my thread about "-bash: ELF: command not found "?

Hi, Today, I've submitted a new tread in "Shell Programming and Scripting" forum, with title "-bash: ELF: command not found ". However, this thread has disappear. Can somebody give me an explanation? Regards. (3 Replies)
Discussion started by: Sonia_
3 Replies

4. Red Hat

Could interrupt disabled cause "opreport error: No sample file found"?

Hi All I would like to profile my application with oprofile but I can't since no samples are collected. The kernel of my app is 2.6 on RED HAT Enterprise 5.3 (Tikanga) so OProfile is setup in timer interrupt mode # opcontrol --list-events Using timer interrupt. I... (0 Replies)
Discussion started by: manustone
0 Replies

5. Shell Programming and Scripting

"Command not found" doing a while loop in bash/shell

i=0 numberofproducts=${#urls} #gets number of entries in array called "urls" numberofproductsminusone=`expr $numberofproducts - 1` #-subtract by one while do wget ${urls} i=$(( $i + 1 )) sleep 10 done I'm getting an error ./scrape: line 22: [0: command not found that... (3 Replies)
Discussion started by: phpchick
3 Replies

6. Shell Programming and Scripting

Bash Script giving "Command Not found"

Hello Geeks, Greetings...I have the following script: #!/usr/bin/bash #Script to generate number of active PDP context & calculate PDP activation #failurefrom EPG-M #Script written by Gbenga Adigun #September 12, 2013 username="xxxxxx" password="xxxxxxxxx" HOSTS=( ggsn01... (6 Replies)
Discussion started by: infinitydon
6 Replies

7. Shell Programming and Scripting

Bash script fails with "function: not found" error

Hello everyone, I am having problems figuring this out. This script below is supposed to create a list of file names with their "md5sum", in a file "lib-list.txt" When I run it "sh component-list.sh " I get this:component-list.sh: 4: component-list.sh: function: not found component-list.sh:... (4 Replies)
Discussion started by: joemb
4 Replies

8. UNIX and Linux Applications

Problem on SQLplus command ""bash: sqlplus: command not found""

Hi all, i face an error related to my server ""it's running server"" when i use sqlplus command $ sqlplus bash: sqlplus: command not found the data base is up and running i just need to access the sqlplus to import the dump file as a daily backup. i already check the directory... (4 Replies)
Discussion started by: clerck
4 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
BCPOW(3)								 1								  BCPOW(3)

bcpow - Raise an arbitrary precision number to another

SYNOPSIS
string bcpow (string $left_operand, string $right_operand, [int $scale]) DESCRIPTION
Raise $left_operand to the power $right_operand. PARAMETERS
o $left_operand - The left operand, as a string. o $right_operand - The right operand, as a string. o $ scale -This optional parameter is used to set the number of digits after the decimal place in the result. You can also set the global default scale for all functions by using bcscale(3). RETURN VALUES
Returns the result as a string. EXAMPLES
Example #1 bcpow(3) example <?php echo bcpow('4.2', '3', 2); // 74.08 ?> NOTES
Note bcpow(3) may return a result with fewer digits after the decimal point than the $scale parameter would indicate. This only occurs when the result doesn't require all of the precision allowed by the $scale. For example: Example #2 bcpow(3) scale example <?php echo bcpow('5', '2', 2); // prints "25", not "25.00" ?> SEE ALSO
bcpowmod(3), bcsqrt(3). PHP Documentation Group BCPOW(3)
All times are GMT -4. The time now is 06:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy