LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2007, 06:25 AM   #1
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Rep: Reputation: 0
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

Last edited by Simon_Penney_2003; 01-28-2007 at 01:06 PM.
 
Old 01-24-2007, 06:59 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
let only handles integer operations. try "bc" for more advanced stuff.

Last edited by acid_kewpie; 01-24-2007 at 07:03 AM.
 
Old 01-24-2007, 07:10 AM   #3
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
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.
 
Old 01-24-2007, 07:17 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
use the bc command, not let.
 
Old 01-24-2007, 07:36 AM   #5
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
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

Last edited by Simon_Penney_2003; 01-28-2007 at 01:07 PM.
 
Old 01-24-2007, 07:38 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
you need to read the documentation to use it correctly, you can't just replace one word for another...
 
Old 01-24-2007, 07:57 AM   #7
Robert Diggs
Member
 
Registered: Dec 2006
Location: Florida
Distribution: The ones that come in magazines and books.
Posts: 136

Rep: Reputation: 15
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
 
Old 01-24-2007, 08:36 AM   #8
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Ahh i dont stand a chance i just cant do it.
 
Old 01-24-2007, 09:46 AM   #9
Robert Diggs
Member
 
Registered: Dec 2006
Location: Florida
Distribution: The ones that come in magazines and books.
Posts: 136

Rep: Reputation: 15
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
 
Old 01-24-2007, 10:28 AM   #10
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
[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
 
Old 01-24-2007, 10:59 AM   #11
Robert Diggs
Member
 
Registered: Dec 2006
Location: Florida
Distribution: The ones that come in magazines and books.
Posts: 136

Rep: Reputation: 15
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
 
Old 01-24-2007, 11:09 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,354
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
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`
 
Old 01-24-2007, 11:29 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

Last edited by acid_kewpie; 01-24-2007 at 11:36 AM.
 
Old 01-24-2007, 11:48 AM   #14
Simon_Penney_2003
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
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.
 
Old 01-24-2007, 11:55 AM   #15
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,354
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic bash script question kevpatts Linux - Newbie 3 10-12-2005 01:02 PM
Basic Bash script help valadamir Programming 2 12-01-2004 10:37 AM
Trouble with a basic bash script Tengil Linux - Newbie 5 03-04-2004 12:59 PM
Basic BASH script, what's wrong??? Satriani Linux - General 2 06-02-2003 05:34 PM
help with basic syntax in bash script Supp0rtLinux Linux - Software 4 03-27-2003 06:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration