04-16-2005
KORN Shell - Spawn new shell with commands
I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server..
I have seen some code that may help - but I cant get it working as below:
spawn /usr/bin/ksh
send "telnet x <port_no>\r"
expect "Enter command: "
send "LOGIN:x:x; \r"
expect "Enter command:"
send "LOGOUT; \r"
close
but this errors - I may be missing code etc, I honestly dont know. Can anyone help me? Or is there another way to do this?
I dont want to execute a script on the other server, I want to log on to it and type some commands, get the response and log off... Please note I log on to server on a specific port - this is not telnet.
Any help would be appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
well i have this code here..and it works fine in kornshell..
#!/bin/ksh
home=c:/..../
input=$1
sed '1,3d' $input > $1.out
line=""
cat $1.out | while read a
do
line="$line $a"
done
echo $line > $1
rm $1.out
however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a script that uses "nohup" command to execute a korn shell script. Which one is the correct shell to use bourne shell or korn shell to execute a korn shell? and why?
Thanks in advanced. (2 Replies)
Discussion started by: XZOR
2 Replies
3. UNIX for Dummies Questions & Answers
I am doing this simple script using c shell and korn shell. The commands I use are fgrep , ls, and also some redirecting. Is there any difference in using both of these commands in c shell and korn shell? Thanks and sorry for the stupid question. (1 Reply)
Discussion started by: EquinoX
1 Replies
4. Shell Programming and Scripting
Hi,
I am new this forum. I request you peoples help in understanding and finding some solution to my problem.
Here it goes:
I need to perform this set of actions by writing a shell script. I need to read a config file for the bunch of processes to execute.
I need to fecth the pid of... (4 Replies)
Discussion started by: sachin4sachi
4 Replies
5. Shell Programming and Scripting
Hi All
I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell.
Some operations like calculation don't work :
cat ${file1} | tail -$((${num1}-${num2})) > ${file2}
Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies
6. Shell Programming and Scripting
Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command ..
$ echo $SHELL
yields me
/bin/sh
Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies
7. Shell Programming and Scripting
I am relatively new to shell scripting. I have a script I wrote that works fine in korn shell.
I need to make it work in bash on a different server.
There are a couple valid korn shell commands I am having difficulty finding the bash equivalents for.
At one point the scripts prompts the... (5 Replies)
Discussion started by: inakajin
5 Replies
8. Shell Programming and Scripting
Hi,
I have a problem with the spawn execution with expect.. i have done the code for expect in a separate file and i am calling the this execution from the bash script.. as given below..
-bash-4.1$ cat main.sh
#!/usr/bin/bash
./spawn.exp
==========================
-bash-4.1$ cat... (2 Replies)
Discussion started by: satishkumar432
2 Replies
9. Shell Programming and Scripting
Hi everyone,
I'm no killer in shell scripting, that is why I've searched and found a little script that explained how to do what I wanted to do : a FTP transfer from distant servers. I adapted it cause as such, it didn't work.
As I needed to do some very simple shell commands (erase and... (2 Replies)
Discussion started by: mederik
2 Replies
10. Programming
def gob(url):
print "\n\t Running gobuster on target."
params = " -e -s '307,200,204,301,302' -t 20 -u " + url + " >> /tmp/%s/gobuster.txt" % (ip)
os.system("xterm -e bash -c "tail -f /tmp/%/gobuster.txt"")
for i in bflist:
dirbf = "gobuster -w " + i... (3 Replies)
Discussion started by: alvinoo
3 Replies
LEARN ABOUT DEBIAN
mldonkey_command
MLDONKEY_COMMAND(1) [FIXME: manual] MLDONKEY_COMMAND(1)
NAME
mldonkey_command - a wrapper to send command to a mlnet server.
SYNOPSIS
mldonkey_command [-P port] [-h host] [-u user] [-p password] [-q] [-s] [-v] {"mlnet command"...}
DESCRIPTION
This manual page documents briefly the mldonkey_command command.
This manual page was written for the Debian GNU/Linux distribution because the original program is Debian GNU/Linux specific.
This program allow you to send command to a mlnet instance. The idea is to provide a simple script to do batch job with mlnet
OPTIONS
-P
Port of the telnet mldonkey server. By default 4000
-h
Host of the telnet mldonkey server. By default localhost
-u
Username to use while connecting. By default admin
-p
Password to use while connecting. If none is specified, ask it on stdin
-q
Run without displaying command result
-s
Use stdin to enter command
-v
Display login information
"mlnet commands"
Any commands you can type in a telnet session connected to mlnet. Try "mldonkey_command longhelp" to see a complete listing.
LICENSE
This manual page was originally written by Sylvain Le Gall gildor@debian.org for the Debian GNU/Linux system (but may be used by others).
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Lesser General Public License, Version 2.1
or any later version published by the Free Software Foundation; considering as source code all the file that enable the production of this
manpage.
SEE ALSO
mlnet (1)
AUTHORS
Sylvain Le Gall <gildor@debian.org>
Author.
Mehdi Dogguy <dogguy@pps.jussieu.fr>
Author.
COPYRIGHT
Copyright (C) 2003, 2004, 2005, 2006 Sylvain Le Gall
Copyright (C) 2009 Mehdi Dogguy
[FIXME: source] Mar 14, 2009 MLDONKEY_COMMAND(1)