On Wed, Jan 25, 2006 at 11:49:39AM +0100, Stephane Durieux wrote: > Hello > > I have a problem in a ssh script: > ssh host << EOF > for o in /directory/* > cp -pr /directory/* /other_location > > the problem is that variable o isn t created in fact. It seems that the it > is created on the remote machine (normal) but cannot be printable on the > local. > what is the reason ? > Can someone give me in depth explanation > I have tried --tt option whithout any result
(Well, maybe somewhat late reply for an urgent question, but anyway...) I suppose the idea is to supply some commands to be run remotely, via "here document" syntax. The key point here is that you need a shell, not a tty, to execute code like you're trying to use (for-loop, "*" globbing, ...). -tt would merely give you a (pseudo) tty. Something like the following should work (of course, substitute more sensible code to run...) #!/bin/sh ssh host /bin/sh << 'EOF' for file in /some/remote/directory/*.jpg ; do echo Found picture: $file done EOF Apart from that, I can only second what David said. Cheers, Almut -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]