LinuxQuestions.org
Help answer threads with 0 replies.
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 07-06-2012, 06:06 PM   #1
stevo520
LQ Newbie
 
Registered: Jun 2012
Posts: 9

Rep: Reputation: Disabled
Post Adding variables then output to another variable


I need to figure out how to have 3 separate variables entered by the user, then added and output as a 4th variable?
 
Old 07-06-2012, 06:20 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Take a look at the "read" command----going to dinner, can't help more ATM
 
Old 07-06-2012, 08:06 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
OK--here is a start:

Code:
while true; do
    read -p "enter a number" num
    echo "the number is" $num
done

Last edited by pixellany; 07-07-2012 at 03:28 AM. Reason: fixed error---"TRUE" should be "true"
 
  


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
[SOLVED] set a variable to a combination of two other variables nesrin Programming 9 08-16-2011 09:02 PM
[SOLVED] Bash; awk or sed output to variable: how keep newline at end of each output line porphyry5 Programming 3 06-10-2011 06:50 PM
[SOLVED] Bash: Making a Variable out of two other variables. youarefunny Programming 4 03-29-2010 07:56 PM
How to make 2 variables from one variable value in awk intikhabalam Linux - General 1 07-30-2008 05:32 AM
Variable names that include variables.... mychl Programming 7 09-24-2003 08:13 AM


All times are GMT -5. The time now is 05:42 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