Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wait for prompt then continue

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
US
I have to run a set of commands under a special environment with in a shell that changes the prompt. Is it possible to do this in ksh, csh or sh and not have to install Tcl/Expect.

invoke new environment:--> this changes propmt from # to $
Run commands there
Type exit to come to main shell
Parse the data
If needed, reinvoke the 2nd shell
do the above again.
 

It could be possible if we had a better explanation and didn't have to guess at the requirements (or are they secret?).
[3eyes]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
why not simply check the value of PS1

Code:
if [ "$PS1" = "$" ]
then
  do stuff
fi


then parse your data and repeat as necessary.


Add a little color to your PUTTY terminal: faq52-6627
 
LKBrwnDBA:
My current prompt is whoami@dir# - when within a script I have to change shells the prompt becomes whoami@dir $. The script stops here and does not proceed, to execute the commands.

sbrews
Since the script stops executing at prompt change, I can't run anything, so I can't check prompt settings.
 
How are you invoking the subshell? How are you specifying the commands to be run within that shell?

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top