From 2d91768d88b14568139b51da4ce0c85cbe837df5 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 21 Nov 2019 00:31:39 +0530 Subject: Fix some cat abuses in code, plugins --- plugins/fzhist | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'plugins/fzhist') diff --git a/plugins/fzhist b/plugins/fzhist index 52f13bf..ca1db63 100755 --- a/plugins/fzhist +++ b/plugins/fzhist @@ -10,10 +10,10 @@ shellname="$(basename "$SHELL")" if [ "$shellname" = "bash" ]; then hist_file="$HOME/.bash_history" - entry="$(cat "$hist_file" | fzy)" + entry="$(fzy < "$hist_file")" elif [ "$shellname" = "fish" ]; then hist_file="$HOME/.config/fish/fish_history" - entry="$(cat "$hist_file" | grep "\- cmd: " | cut -c 8- | fzy)" + entry="$(grep "\- cmd: " "$hist_file" | cut -c 8- | fzy)" fi if ! [ -z "$entry" ]; then @@ -21,10 +21,8 @@ if ! [ -z "$entry" ]; then echo "$entry" >> $tmpfile $EDITOR $tmpfile - cmd="$(cat $tmpfile)" - - if ! [ -z "$cmd" ]; then - $SHELL -c "$cmd" + if [ -s $tmpfile ]; then + $SHELL -c "$(cat $tmpfile)" fi rm $tmpfile -- cgit v1.2.3-70-g09d2