LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help - Tring to write basic currency Converter as a bash script (https://www.linuxquestions.org/questions/linux-newbie-8/help-tring-to-write-basic-currency-converter-as-a-bash-script-522324/)

Simon_Penney_2003 01-24-2007 06:25 AM

Help - Tring to write basic currency Converter as a bash script
 
i haven't had much luck so far ********

as you can guess i'm not very good, can someone please help me, or point me in the right direction. Thanks

acid_kewpie 01-24-2007 06:59 AM

let only handles integer operations. try "bc" for more advanced stuff.

Simon_Penney_2003 01-24-2007 07:10 AM

Quote:

Originally Posted by acid_kewpie
let only handles integer operations. try "bc" for more advanced stuff.

I'm sorry but i dont even understand this.

acid_kewpie 01-24-2007 07:17 AM

use the bc command, not let.

Simon_Penney_2003 01-24-2007 07:36 AM

Quote:

Originally Posted by acid_kewpie
use the bc command, not let.


so i've replaced the let with bc to leave me with this:

echo please enter the amount in `$` that you wish to convert
read

but this still doesnt work

acid_kewpie 01-24-2007 07:38 AM

you need to read the documentation to use it correctly, you can't just replace one word for another...

Robert Diggs 01-24-2007 07:57 AM

A wise man on here once said "Understand what you're doing, don't memorize it." I suggest you do that same FOOL! I'm joking, you're not a fool. Like Acid said, take your time to read documentation. You'll save yourself a bunch of frustration. If all else fails, see if you can find the source for a similar program, disect it and see where you're going wrong.

Regards,

Brandon

Simon_Penney_2003 01-24-2007 08:36 AM

Ahh i dont stand a chance i just cant do it.

Robert Diggs 01-24-2007 09:46 AM

Now you definitely won't be able to do it with that attitude. Have you tried googling it? Go to Google.com/linux. you might be able to find something there. Alternately, try a different Linux site. There are more Linux Guru's in the world than just this one site. You have to be able to utilize all of your resources. That's what makes a good Computer Programmer/Technician. You CANNOT do everything on your own, everyone knows that. it's a nice thing to strive for, though.

Regards,

Brandon

Simon_Penney_2003 01-24-2007 10:28 AM

[QUOTE=Robert Diggs] Go to Google.com/linux. [/QUOTE

I've searched in the google linux thing, but still no luck. I've been trying this for days and i'm still no further than i was. I've read book after book. I just dont understand. Am i even on ther right lines? I really don't have a clue

Robert Diggs 01-24-2007 10:59 AM

hey,

Not sure if you're on the right lines, I'm not very knowledgeable when it comes to programming. But, like with anything, the answer will come with research and patience. Look up other progamming or Linux forums. Use google or another search engine to find another forum.

Regards,

Brandon

unSpawn 01-24-2007 11:09 AM

Stupid example of what 'bc' could look like ITW...
 
Code:

A=100; B=2; C="0.93"; D=`echo "scale=2;($A-$B)/$C"|bc -l 2>/dev/null`

acid_kewpie 01-24-2007 11:29 AM

I'd note that the above example is lot more complex than what you'd actually need...

Simon_Penney_2003 01-24-2007 11:48 AM

Quote:

Originally Posted by acid_kewpie
I'd note that the above example is lot more complex than what you'd actually need...

Thats an understatement. It jibberish to me. So i take it from what people are saying, im not even close to getting this working.

unSpawn 01-24-2007 11:55 AM

Maybe some Bash scripting guides first, then:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
http://www.tldp.org/LDP/abs/html/


All times are GMT -5. The time now is 08:50 AM.