[Tcsh] Issue with tcsh :t modifier when no path given

David Ljung Madison Stellar tcsh.org at daveola.com
Tue Jun 11 23:15:41 UTC 2024


Found an issue with the tcsh :t history modifier that did not use
to be a problem.  The :t modifier fails if the word has no path,
which is not only difficult to deal with, but also not consistent with :r.

>From the man page:

  :t       Remove  all  leading  pathname  components,  leaving the
           tail.

  :r       Remove a filename extension  ‘.xxx’,  leaving  the  root
           name.

Examples of :t and :r, both when path/extension are given and not:

# Current version of tcsh is 6.24.12:
% echo $tcsh
6.24.12

# :t only works if we have a path
% alias base 'echo base is \!^:t'  
% base /foo/bar
base is bar
% base bar
Modifier failed.

# :r works fine either way
% alias nopost 'echo nopost is \!^:r'
% nopost foo.bar
nopost is foo
% nopost foo
nopost is foo


I am confident that this was not the case previously (possibly
back as far as 6.14.00, though I am unable to compile that version
currently)



---------------------------------------------------------------------------
Dave Madison Stellar (he/him)       http://GetDave.com/        415.341.5555
---------------------------------------------------------------------------


More information about the Tcsh mailing list