fzn: output selected line number with fzf instead text
fzn: output selected line number with fzf instead text
Regular call to fzf, but output the index number of the selected entry, instead the text itself. It's a pretty niche use case, but there was a few times in the past when I needed it. You can use options for fzf just normally too.
bash
fzn() { nl | fzf --with-nth 2.. "${@}" | awk '{print $1}' }
Usage:
bash
find . -maxdepth 1 -type d | fzn -e -m
I always forget how to do this manually, so I made this simple function for Bash. Just copy this like an alias into your .bashrc and use it like any other command in a pipe.