由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - shell question , help?
相关主题
Using Ksh to ftp files请问Kshell是不是指korn shell啊
Re: How to setup the arrowkey(for history command) and table-completewhere can I find some good website for C Shell ?
How to test an empty string in shellshell programming problems
how to redirect error output under unix帮帮忙,用C作一个SHELL
a question in shell script为什么我就是不会写Shell script?
which shell is the best among csh, ksh, bsh?[转载] how to get the return value of a command by shell?
Shell Script Question about HostnameRe: [转载] how to get the return value of a command by shell?
Korn shell scripthelp shell script (waiting on line)
相关话题的讨论汇总
话题: shell话题: command话题: host话题: host1话题: host2
进入Unix版参与讨论
1 (共1页)
d*****y
发帖数: 12
1
Hi,
I am writing a Korn Shell program now on host1, but I need to run
some commands and retrieve the results from host2, my question is how
to implement this in Korn Shell:

1. telnet to host 2 from host 1
2. run a command line from host 2
3. retrieve the result to host1.
4. close the connection.
Thanks a lot!
r*****s
发帖数: 985
2
I don't know much about KSH, but I think it is basically the same:
% echo `ssh username@hostname -x "command line"`

【在 d*****y 的大作中提到】
: Hi,
: I am writing a Korn Shell program now on host1, but I need to run
: some commands and retrieve the results from host2, my question is how
: to implement this in Korn Shell:
:
: 1. telnet to host 2 from host 1
: 2. run a command line from host 2
: 3. retrieve the result to host1.
: 4. close the connection.
: Thanks a lot!

a*********a
发帖数: 22
3
1. If your system supports rsh, use rsh to excute the command:
host1%> rsh host2 command
then use rcp command to copy the result from the remote host.
2. Or you can use expect to non-interactively log into the remote
host and excute the command, then also use expect to non-interactively
ftp the results back.

【在 d*****y 的大作中提到】
: Hi,
: I am writing a Korn Shell program now on host1, but I need to run
: some commands and retrieve the results from host2, my question is how
: to implement this in Korn Shell:
:
: 1. telnet to host 2 from host 1
: 2. run a command line from host 2
: 3. retrieve the result to host1.
: 4. close the connection.
: Thanks a lot!

G*****a
发帖数: 183
4
depends on which command your systems supports, you could try either ssh or
rsh. Or you could try to use a utility named "connect" along with "expect"
but you need to write a profile in advance.
ssh will be the easiest, I think. Plus if you don't have one, it is time to
install. (since telnet is not secure enough, as I know, many univesities have
began change telnet to ssh now).

【在 a*********a 的大作中提到】
: 1. If your system supports rsh, use rsh to excute the command:
: host1%> rsh host2 command
: then use rcp command to copy the result from the remote host.
: 2. Or you can use expect to non-interactively log into the remote
: host and excute the command, then also use expect to non-interactively
: ftp the results back.

f***y
发帖数: 98
5
Right, but you need to create a public key on the host1 and copy it into
host2, make sure enter nothing when prompted for password.
then run ssh user2@host2 -x "command". Otherwise, you will keep
getting prompted for password.

【在 r*****s 的大作中提到】
: I don't know much about KSH, but I think it is basically the same:
: % echo `ssh username@hostname -x "command line"`

D****g
发帖数: 2860
6
Hoe to create the pub key? using ssh-keygen? then copy the file ending
with .pug? where to copy then?

【在 f***y 的大作中提到】
: Right, but you need to create a public key on the host1 and copy it into
: host2, make sure enter nothing when prompted for password.
: then run ssh user2@host2 -x "command". Otherwise, you will keep
: getting prompted for password.

f***y
发帖数: 98
7
It should be in the file ~/.ssh/id_rsa.pub if using rsa protocol.
it works. I've tried before.
however, it is not secure if you leave password blank. it's better
to remove the id_rsa files when you are done.

【在 D****g 的大作中提到】
: Hoe to create the pub key? using ssh-keygen? then copy the file ending
: with .pug? where to copy then?

1 (共1页)
进入Unix版参与讨论
相关主题
help shell script (waiting on line)a question in shell script
AIX shell configurationwhich shell is the best among csh, ksh, bsh?
Re: how to change my default shellShell Script Question about Hostname
Shell script problem? (转载)Korn shell script
Using Ksh to ftp files请问Kshell是不是指korn shell啊
Re: How to setup the arrowkey(for history command) and table-completewhere can I find some good website for C Shell ?
How to test an empty string in shellshell programming problems
how to redirect error output under unix帮帮忙,用C作一个SHELL
相关话题的讨论汇总
话题: shell话题: command话题: host话题: host1话题: host2