Re: strange tcsh. vs. bash behavior of scp
From: Bill Unruh (unruh@physics.ubc.ca)Date: 01/06/02
- Next message: fresh: "Re: A Challenge"
- Previous message: George: "FreeBSD and Open SSh"
- In reply to: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Next in thread: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Reply: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: unruh@physics.ubc.ca (Bill Unruh) Date: 6 Jan 2002 22:16:18 GMT
In <a16pe3$13nq$1@hedeland.org> per@bluetail.com (Per Hedeland) writes:
]In article <vXjZ7.14408$TM3.8759@nwrddc02.gnilink.net> "Nico
]Kadel-Garcia" <nkadel@bellatlantic.net> writes:
]>
]>"Richard E. Silverman" <slade@shore.net> wrote in message
]>news:m1l3d1mssyy.fsf@syrinx.oankali.net...
]>>
]>> > When I give the following command
]>> >
]>> > scp me@mymachine.univ.edu:file.* .
]>> >
]>> > from a tcsh I get the reply
]>> > "no match"
]>> >
]>> > But if I do the same thing from bash I get a proper
]>> > response (i.e. query for password, and downloading of
]>> > appropriate files).
]>>
]>> This has nothing to do wiht SSH; it is because of different quoting
]>> conventions between bash and tcsh. Bash does not happen to try to expand
]>> the glob because of the syntax, but tcsh does.
]Well, just to nitpick (and be off-topic:-), both shells try to expand
]the glob, but for a sh-type shell such as bash it is not an error for
]such an expansion to fail, it just leaves the pattern as-is, while for a
]csh-type shell such as tcsh, it is an error. You can make it not be an
]error in a csh-type shell by doing 'set nonomatch', but it may not be
]the generally desirable behaviour for interactive usage.
]Note the implication that in the (here unlikely, but still possible)
]case that the glob pattern *did* match one or more local files, either
]shell would do something totally different than what was intended - so
]quoting should always be used in a case like this.
]>> Simply enclose the first
]>> argument in single quotes; you want it to be expanded on the remote side,
]>> not here.
]>
]>Richard, oh ghod of SSH support, all blessings upon your head.
]>
]>Most of use this syntax instead:
]>
]> > scp me@mymachine.univ.edu:file.\* .
]>
]>I've found through bitter experience that keeping track of quotes can be a
]>horrid process, especially when you have things like shell scripts calling
]>perl scripts from inside Makefiles. It has been consistently much easier to
]>use backslashes, and just keep adding or deleting them as necessary.
]You didn't say of what population the most used that syntax:-), so I
]can't really comment on its accuracy, but I suspect that claim would be
]wrong for many populations - at least personally I basically never use
]backslash quoting, in interactive use or script writing, finding quotes
]to be far less cumbersome. YMMV, I guess.:-)
]--Per Hedeland
]per@bluetail.com
Remember that it is the local machine that expands the * in that line.
tcsh fines no files which start with file. and complains that there are
none. Bash by default tried to expand, but if there are none, it passes
on the literal *. But this is bad practice .
use the above suggestion or use
scp 'me@mymachine.univ.edu:file.*' .
instead so the * gets passed on to the other side.
- Next message: fresh: "Re: A Challenge"
- Previous message: George: "FreeBSD and Open SSh"
- In reply to: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Next in thread: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Reply: Per Hedeland: "Re: strange tcsh. vs. bash behavior of scp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|