Redirect find errors to /dev/null

This commit is contained in:
Sheldon Lee 2023-06-05 01:46:30 +01:00
parent b19ab6990b
commit a084750335

View File

@ -7,7 +7,7 @@
# directory. # directory.
goto() goto()
{ {
path=$(find $1 | fzf) path=$(find $1 2> /dev/null | fzf)
[ -f "$path" ] && path=$(dirname "$path") [ -f "$path" ] && path=$(dirname "$path")
cd "$path" cd "$path"
} }
@ -15,7 +15,7 @@ goto()
# Quickly find and edit a file within ~/.config or ~/Documents # Quickly find and edit a file within ~/.config or ~/Documents
cfg() cfg()
{ {
file=$(find $HOME/.config $HOME/Documents -type f | fzf) file=$(find $HOME/.config $HOME/Documents -type f 2> /dev/null | fzf)
[ -z "$file" ] && return [ -z "$file" ] && return
$EDITOR "$file" $EDITOR "$file"
} }
@ -24,7 +24,7 @@ cfg()
# session there with the name of the directory. # session there with the name of the directory.
ts() ts()
{ {
dir=$(find -L $HOME/.config $HOME/Documents -type d | fzf) dir=$(find -L $HOME/.config $HOME/Documents -type d 2> /dev/null | fzf)
[ -z "$dir" ] && return [ -z "$dir" ] && return
tmux new -s $(basename "$dir") -c "$dir" tmux new -s $(basename "$dir") -c "$dir"
} }