Programming :: Invoke The Calculator In Bash Script?

May 16, 2010

My main problem right now is doing floating point arithmetic within a bash script, with variables.Right now I have a folder called "myExamples" with a script called "run_example" that runs with no issues.I plan to(1) create many folders inside [myExamples], that are named [example10] [example11]...each containing an identical copy of (run_example),(2) modify Line 172 of each copy of (run_example)...in one copy, it would be 3.00, the next copy would have 3.05, etc. (This part doesn't work!)How can I use the available calculator bc code to do floating point operationsMy code is below -

#!/bin/sh
# run from directory where this script is
cd `echo $0 | sed 's/(.*)/.*/1/'` # extract pathname

[code]....

View 1 Replies


ADVERTISEMENT

Programming :: Invoke The Calculator "bc" In Bash Script For Floating Point Arithmetic?

May 15, 2010

My main problem right now is doing floating point arithmetic within a bash script, with variables.Right now I have a folder called "myExamples" with a script called "run_example" that runs with no issues.I plan to(1) create many folders inside [myExamples], that are named [example10] [example11]...each containing an identical copy of (run_example),(2) modify Line 172 of each copy of (run_example)...in one copy, it would be 3.00, the next copy would have 3.05, etc. (This part doesn't work!)How can use the available calculator bc code to do floating point operations?My code is below -

#!/bin/sh
# run from directory where this script is
cd `echo $0 | sed 's/(.*)/.*/1/'` # extract pathname

[code]...

View 2 Replies View Related

Programming :: Invoke Java From Bash Terminal Via Shell Script Fails Under Mint Debian / Fix It?

Feb 16, 2011

I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine.
Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...

View 3 Replies View Related

General :: Invoke A Function In Bash Shell Script?

Apr 24, 2010

I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script.

When I set the variable PS1 in ~/.bashrc, I can't invoke the function by one_func
ex:

export PS1="
[e[31m] $(one_func) # it works
export PS1="
[e[31m] one_func # it doesn't work

View 3 Replies View Related

Fedora :: No Decimal Point In Programming Calculator?

Dec 9, 2010

I just noticed there doesn't seem to be a decimal point button on the calculator (gcalctool 5.32.0) when it is in programming mode. I'm using Fedora 14 (32-bit).

View 4 Replies View Related

Programming :: Invoke Methods Via Ssh On Servers From CSV?

Jan 14, 2011

I have to execute certain commands (like shutdown Tomcat) on several servers so I'm using a loop and ssh. I put the server's IP on a CSV file which I parse, execute the commands for each line and send the output to a file. The problem is that after processing one line the program stops execution. I wonder if someone could lend me a hand with this, I'm new in bash scripting and I ran out of ideas.

The CSV (servers.csv) file looks like this:

Code:

192.168.254.5:Server 1
192.168.254.6:Server 2
...

And the script looks like this:

Code:

#!/bin/bash
while IFS=: read ip name
do
sshpass -p "pass" ssh -o "StrictHostKeyChecking no" root@"$ip" 'sh <CATALINA_BASE>/bin/shutdown.sh' >> output.log
done < servers.csv

View 1 Replies View Related

Programming :: Print Cgi Result (loan Calculator) Using Popup

Jan 7, 2010

I am using the script below but need to make it to show the result in a html popup window. The script is Free and I don't think Kristina will complaint by making it more versatile.

The problem I have is that the script moves to a standalone window to show the results. I am interested in making it "popup' a window with the results.

Code:
#!/usr/bin/perl
# NOTE: You must change the line above to point to the path to Perl
# on your system.
#########################################################################
##### AffordaBilly v1.0#
##### Copyright 2001, Kristina L. Pfaff-Harris, scripts@tesol.net#

[Code]....

View 1 Replies View Related

Programming :: Invoke A ButtonPress Event Using XLib?

Nov 17, 2010

I'm working on an application which generates random shapes when clicking on a window. I designed the window using Motif. I want to invoke the ButtonPress Event .

View 1 Replies View Related

Programming :: Invoke Cairo Functions From Glade?

Feb 12, 2011

I have created a glade file which so far have two regions in it:

1) On the right division is a toggle button which calls a C script when enabled.

2) I have a drawing area, in which I would like to plot a point (X-Y scatter plot). The plot should be generated dynamically using a C script. I am not sure how the integration between the two is possible for a drawing area.

In glade what properties of drawing area should I set? eg.expose event, realize etc. I was thinking of using cairo for generating the plot.

View 2 Replies View Related

Programming :: Not Able To Invoke Variable Values / Sort It?

May 5, 2010

I am trying to import variable values from a profile file to a perl program.
I am using the below command for doing it.

Quote:

system (". /opt/bbfb/bin/setbbfbenv $codeset");

the above command does make variable values available to the running perl program..
Can some one help me on this front..

View 1 Replies View Related

Programming :: Can't Invoke A Command From Within Shell Script / Sort It?

May 17, 2010

When I try to invoke 'source' command from within a shell script, namely, myscript.sh, I get the following error message code...

View 1 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Fedora :: Graphing Calculator Program For KDE?

Apr 10, 2010

Does anybody know of a good graphing calculator program for Fedora 12 KDE? I tried fung-calc and some problems are occurring in the installation. I have followed the directions in the README, and I am doing something wrong, although I am following the directions in the README. Basically, it can't make. I get a message stating:

Code:

[root@localhost fung-calc-1.3.2b]# ls
acinclude.m4 configure.files Fung_calc.kdevelop NEWS
aclocal.m4 configure.in fung-calc.spec.in README

[code].....

View 14 Replies View Related

Ubuntu / Apple :: Calculator Does Not Launch In 10.10 PPC?

Dec 4, 2010

When I try to launch the Calculator from the Applications menu I get the "Starting Calculator" tab in the bottom panel, but the application never launches and the tab disappears after a few seconds.

View 6 Replies View Related

Ubuntu :: Get The Calculator Icon On Top Taskbar?

Feb 15, 2011

i cannot work out how to get the calculator icon on my top taskbar so i can access it fast from there, i know that with ubuntu you right click on it and add to taskbar, this doesnt seem to do it with xubuntu, i cannot work out how to do it.

View 5 Replies View Related

Software :: Calculator Casio Or Ti- Emulator ?

Jan 19, 2011

Do you know some calculator casio or Ti- emulator for linux ?

View 6 Replies View Related

Red Hat :: Can't Find A Crc32 Calculator In Centos 5

Sep 13, 2010

I have looked around but I can't find a crc32 calculator in Centos 5. Is there a native app or one I can download?

View 1 Replies View Related

Slackware :: Calculator Not Working In Gsb-current

Nov 20, 2010

I see the "starting calculator" icon but it just disappears after a few seconds. If gcalctool is run from a terminal it prints Code: GLib-GIO-ERROR **: Settings schema 'org.gnome.gcalctool' is not installed The way to fix it : Code: cd /usr/share/glib-2.0/schemas/ glib-compile-schemas .

View 1 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

Mar 31, 2011

I need to rename the resulted searched files from a loopI have the following code:

find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done

basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell

View 10 Replies View Related

Ubuntu :: Software That Can Replace Graphing Calculator?

Oct 4, 2010

I'm currently reading math courses at home, as opposed to doing it in school, and Swedish schools recommend getting a TI 80 or TI 83 calculator for these math courses. If I'd actually buy one of them, a TI 83 would probably be a better choice since it would last me through more courses, but for now a TI 80 calculator is enough. They are graphing calculators, for anybody that doesn't know.

Anyway, since I'm reading at home, and these calculators are a little expensive, I was looking at software to replace them... The gnome calculator that comes with Ubuntu is a good start, and is probably almost enough for what I will need for now, but it lacks the graphing capabilities, which I will need.

Is there either a more complete calculator, or something to complement the gnome calculator, that will suite my needs? I know I could look through all of the calculators in the repos, but frankly it takes quite a bit of time.

View 2 Replies View Related

Ubuntu :: The Calculator Makes Mouse Unusable In 10.10

Oct 12, 2010

When I press the calculator key on my keyboard and the calculator comes up, I can't use my mouse anymore. I can move it but I can't click on anything. Is there a fix for this?

View 4 Replies View Related

Ubuntu :: Possible To Edit Source Code Of Calculator?

Dec 23, 2010

I want to know if it is possible to edit the source code of the programs in Linux. Like, take the calculator for instance. If I want to add a user-defined function to it, how can I do it - if I can do it at all? In general, where and how can I look at the source code of such programs ?

View 3 Replies View Related

Ubuntu :: Change Calculator Mode In Natty?

Apr 30, 2011

Just upgraded to Natty and I cannot figure out how to change the calculator mode to scientific.

View 2 Replies View Related

Ubuntu :: Axis C++ Calculator Sample Not Working

Mar 29, 2011

I have followed the calculator sample tutorial and cannot get the the calculator client working, the problem appears on the server side. I am working on Linux, I am using:

- Axis C++: axis-c-linux-current-bin.
- Xerces (parser xml): xerces-c2_2_0-linux8.0gcc32
- Apache 2: httpd-2.0.64.

I have used Eclipse to compile the example. When I run the calculator client I get the following message on the command line: "terminate called after throwing an instance of 'axiscpp::SoapFaultException' what(): Cannot deserialize the requested element " and warning message:

[code]....

View 3 Replies View Related

General :: Php Cannot Invoke The Msmtp

Mar 7, 2011

I want to use php for mailing on linux.But when I do it with"$a=`msmtp niubl967@gmail.com < /u1/ftp/mail.txt &`",it does not work.The mail.txt's contents are following:

Subject:test

View 6 Replies View Related

Software :: How To Invoke The Xterminal

Jul 6, 2010

setting up the Xterminal ( xmanager ) application on Linux. I've installed Xterminal-1.0.7-1.i386.rpm on RHEL 4.0.May i know how could i invoke the installed application? What commands should i use?

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved