06-03-2009
Command Output to Standard Input
Hi All,
How do I provide the output of a command to another command which is waiting for an input from the user ?
Ex : I need to login to a device via telnet. In the script, initially I use the "read" command to get the IP Address, Username and Password of the device from the user. Now, after issuing the telnet command in the script, I want to provide the username output read initially.
How would I do that ? Anyone help me out please.
Thank You.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am sending a kill comand to kill a process inside a SH script but I don`t want the user to notice it so I don´t want the message "1222 killed" to appear.
I`ve tried to redirect the standard output to /dev/null 2>&1 and also tried to use "nohup" but none of them was succesfull.
Can anyone... (1 Reply)
Discussion started by: pguinal
1 Replies
2. Shell Programming and Scripting
This site has been very helpful thus far.. I thank you all in advance for sharing the knowledge. Let me get to it.
I am trying to write a very small script to take away from the boredom of doing the same thing over and over.
Everynow and again I have to get the hex value of a file using a... (2 Replies)
Discussion started by: BkontheShell718
2 Replies
3. Shell Programming and Scripting
Hi guys. Is it possible (I'm sure it is) to use the output of a simple 'ls' command as input of another command 'tail'.
It is not really the output of the 'ls'. I have to useeach line of the output.
This is the first command...
ls *myFile*021308*
Which it outputs many filenames. For each... (3 Replies)
Discussion started by: rodrimuino
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script.
I am planning to do like this:
if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I want to check a particular word is in standard error output or not. Can I acheive it in single command?
For example,
Delete file_name 2>error.log
cat error.log
Output:
XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX
Successfully deleted
XXXXXXXXXXXXXXXXX
where delete is... (2 Replies)
Discussion started by: poova
2 Replies
6. UNIX for Dummies Questions & Answers
Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway?
Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies
7. Shell Programming and Scripting
Hi all .... vexing problem here ...
I am using sed to replace some special characters in a .txt file:
sed -e 's/_<ED>_/_355_/g;s/_<F3>_/_363_/g;s/_<E1>_/_341_/g' filename.txt
This command replaces <ED> with í , <F3> with ó and <E1> with á.
When I run the command to standard output, it works... (1 Reply)
Discussion started by: crumplecrap
1 Replies
8. Red Hat
I ran the following command.
cat abc.c > abc.c
I got message the following message from command cat:
cat: abc.c : input file is same as the output file
How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies
9. Shell Programming and Scripting
Hi All,
Hoping you can help as im in desperate need... I'm very new to unix scripting so apoligies,
I have setup an expect script in order to log into a node on our network, This will provide an output as per the below
*********** information:
*************: n/a
TEST IP : n/a
... (18 Replies)
Discussion started by: mutley2202
18 Replies
10. Homework & Coursework Questions
Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints.
1. The problem statement, all variables and given/known data:
How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies
LEARN ABOUT DEBIAN
fence_rsa
FENCE_AGENT(8) System Manager's Manual FENCE_AGENT(8)
NAME
fence_rsa - Fence agent for IBM RSA
DESCRIPTION
fence_rsa is an I/O Fencing agent which can be used with the IBM RSA II management interface. It logs into an RSA II device via telnet and
reboots the associated machine. Lengthy telnet connections to the RSA II device should be avoided while a GFS cluster is running because
the connection will block any necessary fencing actions.
fence_rsa accepts options on the command line as well as from stdin. Fenced sends parameters through stdin when it execs the agent.
fence_rsa can be run by itself with command line options. This is useful for testing and for turning outlets on or off from scripts.
Vendor URL: http://www.ibm.com
PARAMETERS
-o, --action=<action>
Fencing Action (Default Value: reboot)
-a, --ip=<ip>
IP Address or Hostname This parameter is always required.
-l, --username=<name>
Login Name This parameter is always required.
-p, --password=<password>
Login password or passphrase
-S, --password-script=<script>
Script to retrieve password
-c, --command-prompt=<prompt>
Force command prompt (Default Value: >)
-x, --ssh
SSH connection
-k, --identity-file=<filename>
Identity file for ssh
-u, --ipport=<port>
TCP port to use for connection with device
-v, --verbose
Verbose mode
-D, --debug-file=<debugfile>
Write debug information to given file
-V, --version
Display version information and exit
-h, --help
Display help and exit
--power-timeout
Test X seconds for status change after ON/OFF (Default Value: 20)
--shell-timeout
Wait X seconds for cmd prompt after issuing command (Default Value: 3)
--login-timeout
Wait X seconds for cmd prompt after login (Default Value: 10)
--power-wait
Wait X seconds after issuing ON/OFF (Default Value: 0)
--delay
Wait X seconds before fencing is started (Default Value: 0)
--retry-on
Count of attempts to retry power on (Default Value: 1)
ACTIONS
on Power on machine.
off Power off machine.
reboot Reboot machine.
status This returns the status of the plug/virtual machine.
list List available plugs with aliases/virtual machines if there is support for more then one device. Returns N/A otherwise.
monitor
Check if fencing device is running. List available plugs/virtual machines or get status of machine (if it does not support more).
metadata
The operational behavior of this is not known.
STDIN PARAMETERS
action Fencing Action (Default Value: reboot)
ipaddr IP Address or Hostname This parameter is always required.
login Login Name This parameter is always required.
passwd Login password or passphrase
passwd_script
Script to retrieve password
cmd_prompt
Force command prompt (Default Value: >)
secure SSH connection
identity_file
Identity file for ssh
ipport TCP port to use for connection with device
verbose
Verbose mode
debug Write debug information to given file
version
Display version information and exit
help Display help and exit
power_timeout
Test X seconds for status change after ON/OFF (Default Value: 20)
shell_timeout
Wait X seconds for cmd prompt after issuing command (Default Value: 3)
login_timeout
Wait X seconds for cmd prompt after login (Default Value: 10)
power_wait
Wait X seconds after issuing ON/OFF (Default Value: 0)
delay Wait X seconds before fencing is started (Default Value: 0)
retry_on
Count of attempts to retry power on (Default Value: 1)
fence_rsa (Fence Agent) 2009-10-20 FENCE_AGENT(8)