tcsh bug 3
Issue
You can use history modifiers to edit words from your history, :t
and :r are useful for taking off the pathname and postfix, respectively.
From the man page:
:t Remove all leading pathname components, leaving the
tail.
:r Remove a filename extension ‘.xxx’, leaving the root
name.
So as an example, we can remove everything but the base word
of a full path (no path or postfix) with something like this:
% alias word 'echo word is \!^:t:r'
But unfortunately at some point recently the :t started to fail
when there was no path. This is not consistent with :r, which
does just fine without a postfix.
Example
# 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)
Fix
Same day fix from Kimmo!