Register a domain and help support LQ
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!


  Search this Thread
Old 06-26-2016, 08:07 PM   #1
LQ Newbie
Registered: Apr 2014
Posts: 2

Rep: Reputation: Disabled
Does bash script has equivalent set /p command as Windows shell command?

I would like to use a bash script to automate variable input process to update system FRU data under one entry. if I can use like set /p type command to stor diffenet variables in the memory then call out at the main command level under different parameters to exacute them at once.
Old 06-26-2016, 09:13 PM   #2
Registered: Jun 2016
Posts: 380

Rep: Reputation: 66
Maybe this:

% read -p "My Msg: " Var
My Msg: my-val
% echo $Var

my google of:
bash prompt for input

I tried
% read --help
which seems to be a shell "builtin", since
% which read
says none in /bin...
Also I found:
( also see: % man [or info] set [vs. env] )

I'm not sure about the "execute" part: maybe eval $Var vs. `cmd` or $(cmd)
(I googled: shell execute variable backquote)

Does this 'solve' your question? (I was surprised to see my XP cmd: set /? gave several pages!)
Feel free to ask more specific/details; best wishes!
Old 06-26-2016, 09:52 PM   #3
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,609

Rep: Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702
N/m I misunderstood what /p did.

Last edited by smallpond; 06-28-2016 at 08:31 AM.
Old 06-27-2016, 06:09 AM   #4
LQ Newbie
Registered: Apr 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
what I am trying to do in Windows was:
set /p pn=what is the device part number?
set /p sn=what is the device serial number?
set /p s=what is server number?

ipmiupdt -p %pn% -s %sn% -i %s$

so I can program the FRU data at once. And what is correct syntax in bash script?
Old 06-27-2016, 03:32 PM   #5
Senior Member
Registered: Dec 2013
Posts: 4,176

Rep: Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837Reputation: 837
instead of asking us to translate your windows commands line by line into bash, maybe you should just learn bash?
there's plenty of tutorials and wikis around the web, e.g. this one.
1 members found this post helpful.
Old 06-30-2016, 06:29 AM   #6
Registered: Jun 2016
Posts: 380

Rep: Reputation: 66
read -p "what ... num?" variablename
Then use $variablename instead of %variablename%

Sorry, I couldn't resist (I'm tired of booting my tinycore/dsl/nanolinux VBoxes & discovering that they aren't the SAME as RH/SUSE/Slackware, or watching Mint take an hour to boot)


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] [SOLVED] bash script: can echo command, command works if I type, but command doesn't work in script ... why? hopeless_n00b Linux - Newbie 9 02-26-2016 02:11 PM
cd command usage a in shell script using bash chuckt6 Linux - Newbie 5 04-21-2012 12:44 PM
Command that works on BASH promp but not from a shell script! ChrisScott Linux - General 4 11-27-2006 08:11 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 03:23 AM
Specifying target directory for command in bash shell script? spectrescape Programming 1 07-22-2004 06:37 PM

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