mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
30 lines
664 B
Bash
Executable file
30 lines
664 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# Description: Fuzzy find executables in $PATH and launch an application.
|
|
# stdin, stdout, stderr are suppressed so CLI utilities exit silently.
|
|
# Works as an independent app launcher.
|
|
#
|
|
# Requires fzy.
|
|
#
|
|
# Usage: nlaunch [delay]
|
|
# delay is in seconds, if omitted nlaunch waits for 1 sec
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Arun Prakash Jana
|
|
|
|
IFS=':'
|
|
|
|
get_selection() {
|
|
ls -H $PATH | sort | fzy
|
|
}
|
|
|
|
if selection=$( get_selection ); then
|
|
setsid "$selection" 2>/dev/null 1>/dev/null &
|
|
|
|
if ! [ -z "$1" ]; then
|
|
sleep "$1"
|
|
else
|
|
sleep 1
|
|
fi
|
|
fi
|