From 74061c222d3595edc06a816762b75824f0b81568 Mon Sep 17 00:00:00 2001 From: rcirillo-pc Date: Tue, 16 Feb 2021 11:19:19 +0100 Subject: [PATCH] added if statement to grepHttp script --- 27-01-2021-grepString/grepHttp.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/27-01-2021-grepString/grepHttp.sh b/27-01-2021-grepString/grepHttp.sh index b8e35c9..019481c 100644 --- a/27-01-2021-grepString/grepHttp.sh +++ b/27-01-2021-grepString/grepHttp.sh @@ -1,3 +1,10 @@ #!/usr/bin/env bash -find . -name '*.java' -exec grep 'http://' /dev/null {} + || echo "No http found" \ No newline at end of file +if [[ "$(find . -name '*.java' -exec grep 'http://' /dev/null {} +)" ]]; then + echo "http protocol found" +else + echo " http not found" +fi + + +find . -name '*.java' -exec grep 'http://' /dev/null {} + || echo "No http found"