LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-11-2005, 06:14 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
bash scripting question


Is it possible to prompt a user for a value, then store it in a variable? I've been all over google, cant seem to find any answers. I know I can pass a variable when calling the script, but I want the script to prompt for it instead, since this script will rarely be used so rather then have to look at the source each time, or accidentally call it directly or something, I just want it to prompt (if possible).
 
Old 07-11-2005, 09:57 PM   #2
t0bbage
LQ Newbie
 
Registered: Jul 2005
Location: New York
Distribution: Red Hat 9
Posts: 5

Rep: Reputation: 0
Try this

Code:
#!/bin/bash
echo What is your name?
read name
echo Hello "$name"
 
  


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
Bash Scripting Question fiod Linux - Newbie 4 11-19-2005 05:09 AM
bash scripting question bmfan Linux - Software 6 11-04-2005 08:54 PM
Bash scripting question. pete1234 Programming 23 09-22-2005 06:52 PM
Bash Scripting Question jsimmonds Programming 2 06-16-2005 09:07 AM
Bash scripting question Hammett Linux - General 4 11-29-2004 06:29 AM

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

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