[Novalug] Messed up file title problem

Michael Henry lug-user at drmikehenry.com
Sun Mar 21 17:19:07 EDT 2010


On 03/21/2010 10:22 AM, Peter Larsen wrote:
> I would NEVER trust globs/wildcards in a case when I have to
> use rm or other manipulation tools.

I understand your caution.  I often give a "test drive" on
potentially dangerous commands.  To test wildcards, I often use
``ls`` on the pattern first to see what files are matched by the
wildcard, then use the up-arrow at the Bash prompt to recall the
previous command, then use the left- and right-arrow and
backspace keys to edit the ``ls`` command line into the more
dangerous version.  For example, to remove a file using a glob
like ``fi*me`` (intended to match ``file name``), I'd do the
following (with the ``-Q`` flag, ``ls`` will quote the filenames
of interest):

  $ touch 'file name'
  $ ls -Q fi*me
  "file name"
  # up-arrow, edit into this:
  $ rm fi*me

Michael Henry




More information about the Novalug mailing list