From aff933f3f4751d176a44eaa7a41a89f69596922f Mon Sep 17 00:00:00 2001 From: Subramaniyam Raizada Date: Fri, 14 Jun 2019 17:20:12 -0500 Subject: [PATCH 1/2] fix bugs when searching for multiple words or for spaces --- spot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spot.sh b/spot.sh index 25f0cd0..fcc55de 100755 --- a/spot.sh +++ b/spot.sh @@ -118,7 +118,7 @@ if [[ "$1" =~ / ]]; then fi # check for empty search -if [ -z "$@" ]; then +if [[ -z "$@" ]]; then echo "(no search term. \`spot -h\` for usage)" exit 1 fi @@ -160,7 +160,7 @@ fi # run search eval "find $dir $findopt -type f $exclude -print0" \ - | GREP_COLOR="1;33;40" xargs -0 grep "${grepopt[@]}" -e "$@" \ + | GREP_COLOR="1;33;40" xargs -0 grep "${grepopt[@]}" -e "`echo \"$@\"`" \ | sed "s/^\([^:]*:\)\(.*\)/ \\ $cyan\1$reset \\ \2 /" \ From 9f07aa736236fa8a60678d837f7378939b4bb924 Mon Sep 17 00:00:00 2001 From: Subramaniyam Raizada Date: Sat, 22 Jun 2019 19:28:06 -0500 Subject: [PATCH 2/2] fix bug when searching for slashes --- spot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spot.sh b/spot.sh index fcc55de..f75c812 100755 --- a/spot.sh +++ b/spot.sh @@ -110,7 +110,7 @@ done if [[ "$1" == "--" ]]; then shift; fi # check for directory as first parameter -if [[ "$1" =~ / ]]; then +if [[ "$1" =~ / ]] && [[ "$1" =~ [^\/] ]]; then if [ -d "$1" ]; then dir=${1/%\//} shift