diff options
author | 2019-11-21 00:31:39 +0530 | |
---|---|---|
committer | 2019-11-21 00:31:39 +0530 | |
commit | 2d91768d88b14568139b51da4ce0c85cbe837df5 (patch) | |
tree | 242b41862ac677a3f275a56aa808a136b5722175 /plugins/fzhist | |
parent | 0c0f12b5286f1e80b13446c69ebef2ee03ae31ec (diff) | |
download | nnn-2d91768d88b14568139b51da4ce0c85cbe837df5.tar.gz |
Fix some cat abuses in code, plugins
Diffstat (limited to 'plugins/fzhist')
-rwxr-xr-x | plugins/fzhist | 10 |
1 files changed, 4 insertions, 6 deletions
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 |