coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Zero-length arguments?


From: Bernhard Voelker
Subject: Zero-length arguments?
Date: Mon, 5 Nov 2012 18:15:29 +0100 (CET)

My question bases on the discussion in:
  https://lists.samba.org/archive/rsync/2012-November/027946.html
where an empty variable $OPTS was passed quoted:
 $ rsync "$OPTS" -avx from to

How should a program react for Zero-length arguments?
Today, coreutils programs give a diagnostic like this:

  $ cat ''
  cat: : No such file or directory

  $ ls -l ''
  ls: cannot access : No such file or directory

I mean, if the argument refers to a file or directory,
then it's impossible for it to be an empty string.

Exceptions are du and wc:

  $ du ''
  du: invalid zero-length file name

  $ wc ''
  wc: invalid zero-length file name

and 'sort --files0':

  $ sort --files0-from=/tmp/x
  sort: /tmp/x:1: invalid zero-length file name

Is this behavior correct / specified somewhere?
At least it should be consistent among coreutils, eh?

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]