4 ms·
Didn't know about "ncd", ended up re-inventing it. The following script, named 'F', takes regexp(3) pattern in $1 and works reasonably well in the 'all text is
by dexen 6y ago
Didn't know about "ncd", ended up re-inventing it. The following script, named 'F', takes regexp(3) pattern in $1 and works reasonably well in the 'all text is hypertex' environment of (p9p) Acme. If it finds one match, it opens it via plumb(1). Otherwise lists results; one right-click opens the clicked result again via plumb(1).
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
- timonoko 6y agoQue? What is rc? "rc - implementation of the AT&T Plan 9 shell". Do I have to install that?
- timonoko 6y agoNevermind now that I think about it, this is basically most of ncd: #! /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.