I just installed autojump but it doesn't seem to be fully compatible with tcsh. In contrast, it works perfectly on bash. However, I want to have it work on my tcsh and thus, I've tried piping my commands to the bash shell like so:
% setenv test "cd `echo '. ~/.bashrc; j public_html' | bash`"
which worked perfectly since:
% echo $test
cd /home/username/public_html
% $test; pwd
/home/username/public_html
But I want to bind the following command to alias j
and its arguments so it will work like the normal autojump program. However, when I attempted to pass the arguments, it does not seem to work, as shown below:
% setenv j "cd `echo '. ~/.bashrc; j $1' | bash`"
% $j public_html
cd: Too many arguments.
% echo $j public_html
cd /home/username/.linuxbrew/share/autojump public_html
% alias j "cd `echo '. ~/.bashrc; j \!:1' | bash`"
% j public_html
cd: Too many arguments.
But, somehow, if I were to pass arguments like this:
% setenv test "echo `echo 'echo {$1,$2}' | bash`"
% $test 2 3
2 3
it works just fine. What exactly am I missing?
Btw here's what I'm expecting:
% j public_html
% pwd
/home/username/public_html
I tried:
% alias jt "bash -c '. ~/.bashrc; j \!:1'"
% alias j 'cd `jt \!:1`'
and it worked.
For more info: https://github.com/wting/autojump/issues/305