Found another undocumented csh feature by looking online at tcsh-related stuff.
Along with being able to use !8, !!, (where !! is equivalent to !-1)
etc. as history substitutions, !# substitutes as the
currently-being-typed command.
> case '#': /* !# is command being typed in (mrh) */
https://cvsweb.openbsd.org/src/bin/csh/lex.c?rev=1.30&content-type=text/x-cvsweb-markup
To test:
echo foo bar !# baz blep

On Wed, Feb 20, 2019 at 9:56 PM Andras Farkas <[email protected]> wrote:
>
> I was reading tcsh's documentation and it mentioned the -q option
> exists in other csh implementations but is often undocumented.
> Comparing behavior between csh -f and csh -fq on OpenBSD 6.4 (though I
> suspect the version doesn't matter for this) showed that the q option
> is indeed accepted and used, as in the latter case, ^\ (SIGQUIT)
> causes csh to quit and dump core, unlike in the former case.
> The source:
> > case 'q': /* -q (Undoc'd) ... die on quit */
> https://cvsweb.openbsd.org/src/bin/csh/csh.c?rev=1.45&content-type=text/x-cvsweb-markup
> confirms this.
> I'm unsure how to best phrase this in csh's man page, though, other
> than simply adopting the wording used in tcsh's man page.
>
> It also turns out the other of the two things in tcsh's man page
> labeled as "usually undocumented" also works in OpenBSD's csh.  The
> `time' variable accepts format flags.
> compare:
> set time=0
> sleep 1
> with:
> set time=(0 %E)
> sleep 1
> The source:
> > case 'E': /* elapsed (wall-clock) time */
> https://cvsweb.openbsd.org/src/bin/csh/time.c?rev=1.17&content-type=text/x-cvsweb-markup

Reply via email to