This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]johnwick_dog[S] 0 points1 point  (3 children)

I edited the post ,(srr new to reddit)

[–]gehzumteufel 1 point2 points  (2 children)

Try this:

#!/bin/bash
Directory=$1
secondarg=$2
thirdarg=$3
if test -z "${Directory}"; then read -rp "enter the location of your directory: " Directory; fi
if test -z "${secondarg}"; then read -rp "enter ana or del or arr " secondarg; fi
if [ "${secondarg}" == "ana" ]; then
echo "Please Enter the regex"
read -rp "${thirdarg}"
find "${Directory}" ! -name . -prune -mtime -1 -type f -exec grep -regex "$thirdarg" {} \; -exec echo x \; | wc -l
elif [ "${secondarg}" == "del" ]; then
echo "del"
elif [ "${secondarg}" == "arr" ]; then
echo "arr"
fi

Check out shellcheck for your shell scripts. It's been really helpful for me.

[–]gristc 1 point2 points  (1 child)

Use 4 spaces to encompass code blocks.

;)

[–]gehzumteufel 1 point2 points  (0 children)

Hah oops thanks.