Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Move command line options to start of line
- X-seq: zsh-users 10809
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx (Zsh users list)
- Subject: Re: Move command line options to start of line
- Date: Sat, 07 Oct 2006 05:39:26 -0700
- In-reply-to: <200610071202.k97C2BbC003441@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200610071202.k97C2BbC003441@xxxxxxxxxxxxxxxxx>
On Oct 7, 1:02pm, Peter Stephenson wrote:
}
} > zsh% ls -s file1 file2 -l
} >
} > the result of the command should be
} >
} > zsh% ls -s -l file1 file2
} >
} > and not
} >
} > zsh% ls -l -s file1 file2
}
} Why?
Because I didn't give a complete example.
Suppose instead that it's
zsh% ls -s *1 *3 -l
Then the result is supposed to be
zsh% ls -s -l -- *1 *3
I.e., you must know where to insert the "--" because you don't know
whether *1 is going to return something beginning with a "-", and if
you know where to put the "--" you know what to put to its left.
(Remember, I'm channeling Korn here, I don't necessarily *agree* that
this is a good idea in the first place.)
The counter-argument (Andrey's point) is that if the example is
zsh% ls -s file1 *2 -l
you don't know if file1 is an option-argument (to -s) or an operand,
so without knowing the semantics of "ls -s" you can't know where to
put the "--".
I haven't bothered disputing Korn on this; I suspect the answer is that
POSIX declares that option-arguments may appear in the same shell word
as the option, so if you cared about POSIX in the first place and you
meant "-s file1" to be a unit then you should already have been writing
zsh% ls -sfile1 *2
and now there's no ambiguity of this type:
} Consider (example contrived on the spur of the moment, but not wholly
} unrealistic):
}
} su -c 'rm -f .zshrc' username -l
But does
su -c'rm -f .zshrc' username
work in a true POSIX shell? Is it required to?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author