Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


Closed Thread
  Search this Thread
Old 03-04-2004, 10:20 AM   #1
LQ Newbie
Registered: Mar 2004
Posts: 11

Rep: Reputation: 0
Unhappy Trouble with a basic bash script

I'm new to bash scripting in linux. I'm trying to make a script that reads numbers users write and then adds them.

This is what I've written so far..

# A script that adds numbers

declare -i number
echo "Enter a number"


for add in *

if [ $NUMBER = $number ]
echo "Plz enter a new number, quit with a character"

echo "You did not enter a number! The sum added up is $sum"
exit 0
Old 03-04-2004, 12:13 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 252Reputation: 252Reputation: 252
What kind of errors are you getting? Why are you declaring the values of NUMBER and sum in the script as 0's? If these are suppose to be read by the person entering them, I would think you don't need these?
Old 03-04-2004, 12:30 PM   #3
LQ Newbie
Registered: Mar 2004
Posts: 11

Original Poster
Rep: Reputation: 0
I'm quite new to this..

What I'm trying to do is to let a user define values that "my" script will add up. Do you have any solution to this?? Plz help..

Last edited by Tengil; 03-04-2004 at 01:46 PM.
Old 03-04-2004, 01:38 PM   #4
Registered: May 2001
Posts: 29,394
Blog Entries: 55

Rep: Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565
Plz help.. schoolwork need to be done by tomorrow
Please read the LQ rules: don't ask us to do your homework.
Old 03-04-2004, 01:55 PM   #5
LQ Newbie
Registered: Mar 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Ooops so sorry... didn't know that.. but now I do
Old 03-04-2004, 01:59 PM   #6
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
And now you do.

Thread closed.

Closed Thread

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 02:02 PM
Basic Bash script help valadamir Programming 2 12-01-2004 11:37 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
Basic BASH script, what's wrong??? Satriani Linux - General 2 06-02-2003 06:34 PM
help with basic syntax in bash script Supp0rtLinux Linux - Software 4 03-27-2003 07:57 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:48 AM.

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