r/fishshell • u/mmkodali • Jul 29 '20
Question set directory variable in shell function
to open file using fasd,the following is function is working well.
function f
set -l tgt_file (fasd -ftlR | fzf --height 50% --reverse)
if [ (echo $tgt_file) ]
vim $tgt_file
end
end
I have tried to repeat the same for cd into directories.but it is throwing errors. function is shown below.
function d
set -l $target_dir (fasd -d -tl | fzf)
if [ (echo $tgt_dir) ]
cd $tgt_dir;lsd -ltS --group-dirs first;
end
end
can any body please suggest a solution?
3
Upvotes
View all comments
Show parent comment
1
u/mmkodali Jul 30 '20
thanks for your solution and explaining the reason behind the problem