-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Boyd Stephen Smith Jr." <b...@iguanasuicide.net> writes:
> In <87fx6mkfhn....@merciadriluca-station.merciadriluca>, Merciadri Luca wrote: >>$ cp *.* >>is equivalent to >>$ cd . ; cp * > > Not true. > > The second misses a file named "foo", as the shell glob "*.*" only matches > filenames with at least one '.' character in their name. > >>$ cp .* >>is equivalent to >>$ cd . ; cp * > > Again, not true. > > The second misses a file named ".foo", as wildcards ('?' and '*' characters) > in shell globs do not match a '.' character in the first position. (This is > part of the "hidden" aspect of dot-files.) > >>A third case is >>$ cp .[a-zA-Z0-9]* >>which is equivalent to copy everything beginning with a dot, and >>ending with whatever you can imagine. > > Again, not true. > > The first misses a file named ".$ntfs$protected", as the bracket/range > expression only catches letters and digits, and may not catch all of them > depending on the collation settings in the environment. > >>Consequently, using >>$ cp .[a-zA-Z0-9]* >> >>and the mere (after or before) >>$ cp * >> >>should copy all the files of a directory to another (they were >>evidently not specified here, as it is trivial stuff). > > I would use (cp {,.[!.]}* "$destination") in shells that do brace expansion > before filename expansion ("globbing"), e.g. bash and zsh. In other shells, > e.g. those without brace expansion, I would write it out as (cp * .[!.]* > "$destination"). > > An alternative I got in the habit of using instead of remembering the "line > noise" above is doing (cp -r "$src/." "$destination"), which is, for me, > semantically closer to what I *mean* than writing something that expands to > all the entries in the directory. > >>I could be wrong for at least one of these facts. If so, we can >>discuss on it. The syntax is actually weird when one begins to play >>with special files. For sure. > > The various expansions done by the shell and the order they are done in is > well-documented by the bash info pages, the zsh man pages, and (for POSIX- > compliant shells) the Single Unix Specification. > > They are not necessarily easy to understand, but I wouldn't use the word > "weird". I think "complex" is a better adjective. Thanks for these rectifications. - -- Merciadri Luca See http://www.student.montefiore.ulg.ac.be/~merciadri/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/> iEYEARECAAYFAktBsC4ACgkQM0LLzLt8Mhz83ACcCEjaTS79kusMdgxGLsrD8mty OvEAn1i1ABf5Pn3qqNsiUjmSilJPMvn7 =rB4V -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org