Regarding bc in Linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regarding bc in Linux
# 1  
Old 08-16-2006
Regarding bc in Linux

i am using Linux OS.
i am not able to use the bc command in shell scripts in the vi editor.
# 2  
Old 08-16-2006
I do not understand what you want to do : to use bc in a shell script or in vi ?

Jean-Pierre.
# 3  
Old 08-16-2006
Regarding bc in mathematical expressions

hi
when i tried to run the follwing script in the vi editor of Linux, I got the error like "bc: command not found"
script is:
a=2
b=5
echo "$a * $b"|bc
# 4  
Old 08-16-2006
Try with the full path of bc, on my AIX box it is /usr/bin/bc.
Use the 'which bc' command to determine the full path on your system/
Code:
a=2
b=5
echo "$a * $b"|/usr/bin/bc

Jean-Pierre.
# 5  
Old 08-16-2006
Regarding bc command.

hi Jean-Pierre,
Thanks for your kind response. I got to know that there is no bc command in Linux, so could you please let me know if there is an alternative way to execute the previous script.

Also the same script can be run by usng 'expr' command in Linux however it can't be used for the complex arithmetic expressions.
# 6  
Old 08-16-2006
First off, linux does in fact have bc. When the linux you are on was "created" someone probably decided not to include some utilities.

Try:
Code:
find / -name bc -type f

to be sure it it not there somewhere in an odd directory like /usr/bin/share/local/
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies

2. Fedora

Which is the better platform to learn UNIX/Linux (Kali Linux Vs. Red Hat or other)?

I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
Discussion started by: ApacheOmega
12 Replies
Login or Register to Ask a Question