Yes, the find -type f focuses on files; nonetheless it's easy enough to right-click-select the relevant directory to open it rather than the file.
#!/usr/bin/env rc
if (~ `{find -type f | 9 grep $1 | wc -l} 1)
plumb `{find -type f | 9 grep $1}
if not
find -type f | 9 grep $1"rc - implementation of the AT&T Plan 9 shell".
Do I have to install that?
#! /bin/bash
d=$(find / -name "$1" 2>/dev/null | head -1)
echo Jumping to $d, Control-D to return
cd $d
bash
Actually it is now perfect. If the guess is wrong, you can return and add letters to you search string.I have it bound to ctrl-e for edit: https://gist.github.com/FeepingCreature/5f575b6fcda041a48f58...
It's like adding the vscode file finder to bash :)
The additional code is to make bash "act as if you typed in the command manually". So you can arrow-up to find it in the history buffer with the filename expanded.
But I already made my own. It is quite perfect:
#! /bin/bash
d=$(find / -name "$1" 2>/dev/null | head -1)
echo Jumping to $d, Control-D to return
sleep 1
cd $d
bashLike I have subdir "/media/tnoko/sdc1/capture/Roinaa/".
"ncd Roi" should be totally sufficient and unique command to go there.