On Sun, Jan 05, 2020 at 10:53:47AM +1100, Dave Horsfall wrote:
On Sat, 4 Jan 2020, Chet Ramey wrote:
It's elegant until you forget that `:'
continues to process redirections.
So just keep remembering that it's an actual command :-)
Which reminds me: which Shell introduced "#" as a true comment?
Hmmm, not quite true; only the C-Shell says "#: Command not found" so it
only works in a script; odd...
Then again, no-one in their right mind uses "csh" :-)
-- Dave
In bash (turning off interactive_comments):
$ shopt -u interactive_comments
$ echo hello # world
hello # world
$ # oh
bash: #: command not found
In zsh (by default):
$ echo hello # world
hello # world
$ # oh
zsh: command not found: #
zsh is the fun one though (allows setting the comment character):
$ histchars[3]='@'
$ echo hello @ world
hello @ world
$ setopt INTERACTIVE_COMMENTS
$ echo hello @ world
hello
$ @ oh, a comment
$
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden