LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-18-2013, 11:18 AM   #1
pukka
LQ Newbie
 
Registered: Jul 2013
Posts: 1

Rep: Reputation: Disabled
Using user input within a script


I'm attempting to write a script to automate an install but I need the web address of the user.
I attempted to echo out the question, get the user to fill it in and then use the address elsewhere in the script but so far I haven't been able to get it to work, it won't even ask the user the question.
Can anyone help with this?
 
Old 07-18-2013, 11:21 AM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Use code tags when you post what you have up to now
 
Old 07-18-2013, 12:10 PM   #3
Awk{}
LQ Newbie
 
Registered: Jul 2013
Location: USA
Distribution: Slackware
Posts: 3

Rep: Reputation: Disabled
Code:
#!/bin/bash

echo -n "Enter web URL: "
read site
echo "You've entered $site as the URL"
This is the simplest example of getting user input. Use the read command and store the user's input in a variable. To recall the variable put a $ sign in front of the varibale.

Last edited by Awk{}; 07-18-2013 at 12:14 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking user input to a script dartec Linux - Newbie 5 04-30-2012 05:58 PM
I cannot figure out how to get user input into a script froster Linux - Newbie 2 11-05-2009 07:13 PM
Shell script user input tuckermaddox Linux - Newbie 5 08-12-2004 03:14 AM
Masking user input in sh script? RMSe17 Linux - Software 3 07-20-2004 10:17 PM
User input using a BASH script... causticmtl Programming 5 07-13-2003 09:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:39 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
Open Source Consulting | Domain Registration