Re: Single argument for mv cp
On Sun, Jun 17, 2007 at 01:14:55AM +0200, Hannah Schroeter wrote: You mean $ cp test{,.bak} See Brace expansion in the ksh(1) manual page. (Note, it's not in sh(1)! After testing I see brace expansion is not described in the sh manual page, but if I invoke sh and type echo a{,b}, the result is still the same as in ksh). the reason it;s not in sh(1) is that sh(1) attempts, not entirely successfully, to describe the functionality of a posix sh. other features are not described. however sh(1) actually supports the same functionality as ksh(1) (it's the same binary after all), except for a few differences. the upshot is /bin/sh can do more than is described in sh(1). and sh(1) is, by necessity, not one million percent accurate. jmc
Re: Single argument for mv cp
Hello! On Sat, Jun 16, 2007 at 04:17:42PM -0700, Clint Pachl wrote: The other day on the Internet I found a shell tip that showed how to use cp or mv with only a single argument. I tried it in the default pdksh in OBSD and it worked. I thought to myself, I can't believe I have been using the shell for over 8 years and didn't know that. Now I can't remember how to do it or where I found the tip. Does anybody know what I'm talking about? (I'm too lazy to look through source for this) This obviously isn't correct, but it went something like this: $ ls test $ cp {test,.bak} $ ls testtest.bak You mean $ cp test{,.bak} See Brace expansion in the ksh(1) manual page. (Note, it's not in sh(1)! After testing I see brace expansion is not described in the sh manual page, but if I invoke sh and type echo a{,b}, the result is still the same as in ksh). Kind regards, Hannah.
Re: Single argument for mv cp
On 17/06/07, Clint Pachl [EMAIL PROTECTED] wrote: The other day on the Internet I found a shell tip that showed how to use cp or mv with only a single argument. I tried it in the default pdksh in OBSD and it worked. I thought to myself, I can't believe I have been using the shell for over 8 years and didn't know that. Now I can't remember how to do it or where I found the tip. Does anybody know what I'm talking about? (I'm too lazy to look through source for this) This obviously isn't correct, but it went something like this: $ ls test $ cp {test,.bak} $ ls testtest.bak This is not actually invoking cp with only one argument. See here: $ set -x $ touch test + touch test $ cp test{,.bak} + cp test test.bak With set -x, the shell will tell us exactly what gets executed. Cheers, Andreas -- Andreas Kahari Somewhere in the general Cambridge area, UK