Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

ideas



Here are a few ideas for new zsh features.  It may be that it is already
possible to do these things with existing features, if so I'd love to know
how.

${...#...} and ${...%...} chop things off the begginning or ends of variables,
and I've wondered why there isn't something like ${i:s/foo/bar} to replace foo
in $i with bar.  With ${(S)...%...} one can chop things out of the center of a
variable, but what if you want to replace it with soething else?  Actually, it
would be even better if you could put in a regexp.  Regexps in the [[ ]]
construct would be nice too---"if echo $blah | grep -q; then..." is kind of
clumsy.  I've written some really ugly perl scripts that would have been much
nicer in shell, but weren't because no shell I know of has very powerful string
handling.

In HPUX, you can chase symlinks by sticking a / on the end of them, even if
they're not directories.  Example:

% touch a
% ln -s a b
% ls -F
a
b@
% rm b/
% ls
a
%

Other OSs don't do this, and even in zsh, something like:

% ls -l =latex
lrwxrwxrwx   1 root     tex             7 Aug 14  1997 /usr/local/lib/texmf/bin/latex -> latex2e
% ls -l =latex/
lrwxrwxrwx   1 root     tex             6 Aug 14  1997 /usr/local/lib/texmf/bin/latex2e -> virtex
% ls -l =latex//
-rwxr-xr-x   1 root     tex        198196 Dec  7  1996 /usr/local/lib/texmf/bin/virtex

won't work because zsh doesn't know about it, and you can't resolve them with
tab.  Even though it's an operating system feature, I see know reason why the
shell couldn't do it too.



Messages sorted by: Reverse Date, Date, Thread, Author