alias ctest 'echo $1; pushd $1'
The screen looks like this:
> ctest /var
/var ~
If I try this one:
alias ctest3 'pushd $1; echo $1'
>ctest3 /var
pushd: No other directory.
could anybody tell me why the $1 system fails in alias? If I type the above
command by:
echo /var; pushd /var
or
pushd /var; echo /var
they both work.
2)
I don't know the problem below:
alias gd 'echo `pwd` > ~/.dirstack; cd $1; set prompt="%{^[[1;30m%}`whoami |
cut -f1 -d'.'``pwd`>%{^[[0m%} ";'
>gd /var
/var: Permission denied.
In fact, if I don't add echo `pwd` > ~/.dirstack, the following alias even
works!
alias cd 'cd $1; set prompt="%{^[[1;30m%}`whoami |
cut -f1 -d'.'``pwd`>%{^[[0m%} "'
Finally, From Sidney Lambe's idea, I would like to modify his code but just
don't know why
set -- $(cat $HOME/.dirstack)
doesn't work in tcsh. How should I use set so all the directories I "cd"
before can be recorded in .dirstack and referred later?
Thanks a lot!
J G Miller pointed out that in csh, $1 should be \!:1
> Finally, From Sidney Lambe's idea, I would like to modify his code but
> just don't know why
>
> set -- $(cat $HOME/.dirstack)
>
> doesn't work in tcsh. How should I use set so all the directories I "cd"
> before can be recorded in .dirstack and referred later?
So the remaining question is how to use set to complete a home-made
directory tcsh manager
set -- $(cat $HOME/.dirstack)
echo
echo "a) $1"
echo "b) $2"
echo "c) $3"
echo
read -s -n1 bb
case "$bb" in
a) cd $1 ;;
b) cd $2 ;;
c) cd $3 ;;
esac