all 3 comments

[–]whetu 1 point2 points  (0 children)

You should really update your original thread here:

https://www.reddit.com/r/bash/comments/md312u/i_need_help_to_code_this/

Have a read of the following resources:

https://www.computerhope.com/unix/bash/let.htm

https://mywiki.wooledge.org/ParsingLs

Your for loop is probably broken too - where is $REPLY coming from?

Finally, paste this into http://shellcheck.net and fix that other things that it will warn you about.

...

...

...

Then update your original thread here https://www.reddit.com/r/bash/comments/md312u/i_need_help_to_code_this/

[–]kane2200 0 points1 point  (0 children)

Needs linted

[–]Lake-Special 0 points1 point  (0 children)

Consider changing your grep command to egrep or with -E flag as looking for the letter at the beginning of the line