[SOLVED] Would like to "echo" a line, "read" reply, then execute the reply: How in bash?
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!
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.
Would like to "echo" a line, "read" reply, then execute the reply: How in bash?
Apologies. I've been out of Unix for 14 years, and the gears have rusted. Also, Unix has changed - enough similarities to memory that I'm pretty comfy though.
Glad to see lots of info available via google. However changes are going to take getting used to. Have set up a testbed of 3 nearly identical machines, hoping to make an (at home) private network where I can automate installs and set-ups using NIS and NFS (Similar to work I once did).
Have found useful scripts interspersed with comments, would like to copy and paste them to a bash script that:
Reads the line.
Echos the line.
Reads the reply.
Executes what is typed.
Essentially, by making myself type (or copy & paste) the commands I think I'll become familiar.
Figured I'd use a spreadsheet, select the file, and paste into column B of the spreadsheet. In column A I'd paste:
and in column C I'd paste:
Then I'd cut and paste into a text document, insert the lines:
behind every command necessary to the actual task.
Figured I'd have to escape the ' and ".
Ran a test (test.bash):
for i in `seq 1 10`;
echo "Enter a command:"
echo "Trying $A"