I just keep on digging how to send in a "y" for whatever return on screen.
As you might need this for other occasions here is how you do it:
Short introduction to I/O redirection
You can picture any process in UNIX to be like a garden hose: something goes in on top, something goes out on the bottom. You can daisy-chain processes in a pipeline with the "|"-symbol, which simply means "connect the output of one process with the input of the other".
Now suppose you want to produce a "y". You could use (try out the following out, it is all non-descructive):
So this is a process which takes nothing in and sends something (a "y") to its output. Let us construct a process processing some input (we could use your compress-process, but we want something we can watch more closely):
Save this to a file "logger.ksh" and make it executable. Try it out on its own (it can be tricked by keyboard artistics like CTRL-C, but enter something "normal" and it does what you would expect - exit on "y" and start over on anything else).
Now call
and you will notice that this is the same as if you would have entered it by keyboard. Lets do another test. In case you wonder about the "\n" - these are just codes for the ENTER-key on your keyboard:
Per default the input of a process is taken from the keyboard - like the shell (which is just another process), which listens there and takes up what you type. But by redirecting the input you can make the process take its input from any other source, just like you can make it put its output to somewhere else (like a file) instead of the screen it would normally output to. You can even use a file for input:
To stay in the garden-hose picture i used above: you plug the respective end of the hose to some device, which can provide/store something to put through the hose - files, devices (like keyboards for input, screens for output) or other processes.
Hi
When I do on console a stop, the script prompts for password
> stop_idm_suite.sh
Suite system password:Here experct of the shell script stop_idm_suite.sh
DoIt()
{
# prompt System password
echo ""
${BMC_JAVA_HOME}/java -Didm.suite.home=${BMC_IDM_SUITE_HOME} -classpath... (1 Reply)
I have to run a script provided by a vendor. Its an executable so I can't change it.
basically after I call it it prompts me for a password. The script does not provide a way for me to pass a password with the command that calls the script.
I would like to automate running this script from... (5 Replies)
Hi,
I want to change the shell prompt, using the cd command.
I have a shell prompt like this -
p78-mfx(dgaw1078/9781)$
Now i do this -
p78-mfx(dgaw1078/9781)$ cd log4j
here the shell prompt should change like this -
p78-mfx(dgaw1078/9781)log4j$ (6 Replies)
Hi
How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Hi All experts, I was asked some questions of late & i was not aware of these. 1Q. how much we can pipe in shell prompt ?2Q. how many arguments we can pass in shell script & how to print that ? (eg, if i want to know what I passed in 11th Argument) ( for 3rd argument we can do echo $3, but I think... (7 Replies)
Hi,
I saw something in weird in Shell prompt.
I did the following steps
1) Typed ls -l and pressed ESC without entering
2) Typed "v" (please notice that I did not type "i" after "v"), which opened vi editor
3) I see the "ls -l" command that I typed in shell prompt
4) Without modifying... (6 Replies)
currently, I set my prompt in my .cshrc file as:
set prompt = "%B%h %m %P %/ \n% "
I have to use certain shells for some specific tasks and would like to set different prompts depending on the type of shell that I am using. Any advice?
Thanks (3 Replies)
Hi, I´m using SCO Unix 5.0.5 and I want to configure de variable PS1, so when I type the command:
cd /etc/
the prompt shows
/etc/_>
Is that possible with sh shell? I´ll appreciate your help.
Thanks, a Happy New Year! (1 Reply)
When I login to a specific machine (running Solaris 2.8; actually serveral machines behave this way), with a known good account, I don't get any shell prompt, and no screen responses to various commands such as ID and PWD. Any ideas on what is causing this, and how to change this behavior? (2 Replies)