Does bash script has equivalent set /p command as Windows shell command?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
I tried
% read --help
which seems to be a shell "builtin", since
% which read
says none in /bin...
Also I found: http://wiki.bash-hackers.org/commands/builtin/read
( 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!
thanks,
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?
lol.
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.