Sponsored Content
Top Forums Shell Programming and Scripting How to send command and respond to prompt Post 302487427 by NOYB111 on Wednesday 12th of January 2011 11:53:37 AM
Old 01-12-2011
How to send command and respond to prompt

I m totally new to this so excuse my ignorance. I want to write a small and simple script to execute in terminal on my MAC. I want to be able to send a ssh command and then once connected send the password and once logged in send two commands.

I can easily write the script to connect, but then I need to deal with the password prompt and sending additional commands. This is to SSH into a device of mine.

Thanks for comments and help!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

any way to use SU command without prompt for password

Hi, First i want to tell you i am not a administrator and everytime to run a sqlscritpt i have to login as SU in a particular account to connect to sqlplus.. I want to write a script which can make me free by doin this .. since i am having the permission for SU i want to know if i can SUDO... (7 Replies)
Discussion started by: myelvis
7 Replies

2. Programming

How do I send email from command prompt?

hi all How do I send email from command prompt? i tried this # mutt -s "Test mail" -a /root/Desktop/email1.txt XXXXX@yahoo.co.in < /root/Desktop/email.txt Error sending message, child exited 71 (Operating system error.). Segmentation fault # and also root@localhost ~]# /bin/mail -s "what... (0 Replies)
Discussion started by: munna_dude
0 Replies

3. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

4. Windows & DOS: Issues & Discussions

Command Prompt

Hi does anyone know know how to find out the password on a vista pc using command prompt /cmd not change it (1 Reply)
Discussion started by: popo123456789
1 Replies

5. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

6. UNIX for Advanced & Expert Users

autosys command(autorep) from command prompt

Hi, I am using AUTOSYS GUI based tool. But I want to get the job status from the UNIX command prompt. 1. I want to execute only autorep command in the UNIX command prompt. If need to execute this command what are the settings need to do that. 2. Is it possible for executing this... (5 Replies)
Discussion started by: onesuri
5 Replies

7. Windows & DOS: Issues & Discussions

[Template] Send SMTP email with Visual Basic Script (vbs) from Command Prompt using CDO

This is a script in visual basic that basically sends an email from an existing account, in this case the example is provided for live.com. It uses CDO (Collaboration Data Objects). All you need to do is replace the fields with the proper information. The email is send from Command Prompt... (0 Replies)
Discussion started by: Tribe
0 Replies

8. UNIX for Dummies Questions & Answers

Execution of command at command prompt

Hello Experts, I am still learning linux and have come across a question, hope to get some answer. I have two servers, and both have the same version of svn client installed and both have the same user_id. my SVN client version: svn, version 1.6.11 (r934486) compiled Mar 2 2011,... (4 Replies)
Discussion started by: babyPen1985
4 Replies

9. Shell Programming and Scripting

Command prompt

Hi All, Even changing .bash_profile, i am getting only $ as command prompt. My bash profile looks like this. PS1=" $ " stty columns 200 set -o vi if i run bash command and run PS1=" $ " then it is working as expected. $ bash (4 Replies)
Discussion started by: akshu.agni
4 Replies

10. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies
write(1)						      General Commands Manual							  write(1)

NAME
write - interactively write (talk) to another user SYNOPSIS
DESCRIPTION
The command copies lines from your terminal to that of another user. When first called, it sends the message: to the receiving user's terminal. When it has successfully completed the connection, it also sends two bells to your own terminal to indi- cate that what you are typing is being sent. To set up two-way communication, the recipient of the message (user) must execute the command: (yourterminal is only required if the originator is logged in more than once.) Communication continues until an end of file is read from the terminal, an interrupt is sent, or the recipient executes At that point, writes on the other terminal and exits. To write to a user who is logged in more than once, use the terminal argument to indicate which line or terminal to send to (e.g., Other- wise, the first writable instance of the user found in database is assumed and the following message is displayed: terminal ... Permission to write may be denied or granted with the command (see mesg(1)). Writing to others is normally allowed by default. Certain commands, in particular and disallow messages in order to prevent interference with their output. However, if the user has the appropriate privileges, messages can be forced onto a write-inhibited terminal. If the character is found at the beginning of a line, calls the POSIX shell (see sh-posix(1)) to execute the rest of the line as a command. The following protocol is suggested for using When you first to another user, wait for the user to back before starting to send. Each per- son should end a message with a distinctive signal (such as "" for "over") so that the other person knows when to reply. Similarly, the signal "" (for "over and out") can be used to indicate the end of the conversation. EXTERNAL INFLUENCES
Environment Variables determines the locale to use for the locale categories when both and the corresponding environment variable (beginning with do not specify a locale. If is not set or is set to the empty string, a default of "C" (see lang(5)) is used. determines the format and contents of date and time strings. determines the language in which messages are displayed. If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. DIAGNOSTICS
The user you are trying to write to is not logged on. Your correspondent has denied write permission after your session started. Your session is ended. Your correspondent sent end-of-file, or you set your terminal to and your correspondent tried to write to you. If you have a session established, you can continue to write to your correspondent. The user you are trying to write to has denied write permission (with Your terminal is set to and the recipient cannot respond to you. EXAMPLES
By issuing the command: user sends a message to user screen. If responds: two-way communication between and is established. FILES
To find user To execute shell commands SEE ALSO
elm(1), mail(1), mailx(1), mesg(1), nroff(1), pr(1), sh-posix(1), sh(1), who(1), utmpd(1M), getutsent(3C). STANDARDS CONFORMANCE
write(1)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy