you are viewing a single comment's thread
view the rest of the comments
[–] 7 points 1 year ago (3 children)

Now I'm imagining a shell that looks iteratively through arguments to find where quotes would make total sense

$ ls
my victims.ods
$ wipe -f my victims.ods --thorough

So the shell would go like

  1. wipe → command name found, ok
  2. -f → no file in the current directory starts with that, skip
  3. my → matches a file, keep in memory...
  4. my victims.ods → full match, but missing quotes!
  5. Prompt user:
Filename "my victims.ods" found without quotes. Choose:
[a]dd quotes this time
[A]lways add quotes (dangerous)
[n]o quotes today please
[N]ever offer adding quotes again
[t]ell me what could possibly go wrong when I choose to always add quotes
[P]unch the person who proposed this feature
  • source
  • hideshow 3 child comments
  • [–] 7 points 1 year ago (2 children)

    For interactive use, tab-completion essentially makes this a non-issue, because shells add escaping in the appropriate places.

    For scripting, where spaces are harder to deal with, unfortunately there's just not much you can do; your two options are basically to learn all of your particular shell's patterns for dealing with whitespace in filenames, or only write scripts in something other than a POSIX shell.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago (1 child)

    Scripting isn't the issue, but for tab completion: the boundary is often at a space or parenthesis so that you need to type the backslash + char to continue tabbing to completion

  • source
  • parent
  • hideshow 1 child comment