File: fzf-find

package info (click to toggle)
sff 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: ansic: 2,160; sh: 621; makefile: 57
file content (24 lines) | stat: -rwxr-xr-x 375 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env sh

# Description: Search file with fzf
#
# Dependencies: fzf
#
# Shell: POSIX compliant
#
# Author: Shi Yanling

sffpipe=$1
PWD=${PWD:-$(pwd)}

sffpipe_enter_dir()
{
	printf ">%s\0" "$1" >"$sffpipe"
}

if ! fzf --version >/dev/null; then
	printf "Press Enter to continue "; read -r _x
	exit 0
fi
_path=$(fzf)
[ "$_path" ] && sffpipe_enter_dir "${PWD}/$_path"