Subject: bug#35564: [PATCH v4] Tweak dired warning about "wildcard" characters

From: Juri Linkov <[email-masked]>
Date: Thu, 15 Aug 2019 23:56:23 +0300

> IIUC, your suggested prompt does not match what dired-do-shell-command
> actually does: the function only ever substitutes '?' if it is
> "isolated", i.e. surrounded with whitespace or backquotes.  Cf. the
> docstring:
>
>> ‘*’ and ‘?’ when not surrounded by whitespace nor ‘`’ have no special
>> significance for ‘dired-do-shell-command’, and are passed through
>> normally to the shell, but you must confirm first.

I collected a short summary that shows one case is still missing
(‘!’ means Dired prompt called on the marked file, and
 ‘$’ is the corresponding shell command):

1. ?

  ! cat ?
  $ cat marked

  ! cat ./?
    Confirm--do you mean to use ‘?’ as a wildcard? (y or n) y
  $ cat ./? marked

  ! cat ?""
    Confirm--do you mean to use ‘?’ as a wildcard? (y or n) y
  $ cat ? marked

  ! cat '?'
    Confirm--do you mean to use ‘?’ as a wildcard? (y or n) y
  $ cat '?' marked
    cat: '?': No such file or directory

  ! cat ./`?`
  $ cat ./marked

2. *

  ! cat *
  $ cat marked

  ! cat ./*
    Confirm--do you mean to use ‘*’ as a wildcard? (y or n) y
  $ cat ./* marked

  ! cat *""
    Confirm--do you mean to use ‘*’ as a wildcard? (y or n) y
  $ cat * marked

  ! cat '*'
    Confirm--do you mean to use ‘*’ as a wildcard? (y or n) y
  $ cat '*' marked
    cat: '*': No such file or directory

Now the missing case - how to do the same that ‘cat ./`?`’ does,
i.e. how to substitute ‘*’ by marked files in such Dired prompt:

  ! cat ./`*`
    Confirm--do you mean to use ‘*’ as a wildcard? (y or n) y
  $ cat ./`*` marked
    /bin/bash: marked: command not found
    cat: ./: Is a directory

Why can't it run this shell command:

  $ cat ./marked