shell - How do I escape characters in a chain of aliases in tcsh? -
i want command cds
greps string within output of dirs -v
, uses pd +
change me directory contains string without removing ring of directories stored within dirs
. instance, if output of "dirs -v"
0 foo 1 bar
then want command cds bar
execute equivalent of pd +1
.
i've defined these:
alias dv dirs -v alias pd pushd alias pds "dv | grep \!:1 | awk '{ print "\$1"}'"
but getting final alias executes pd +n
, n current entry in output dirs -v
, hard part. here 1 attempt, output:
% alias nds "\\\`pds \\!:1\\\`" grep: trailing backslash
as can see, i'm trying escape backticks backslash, escape backslash (escaped) backslash. apparently doesn't job. need instead?
xargs
useful "flatenning" commands containing backtick-nesting.
in case, can used like:
alias nds 'pds \\!:1 | xargs pd'
Comments
Post a Comment