The script that I have to write must find the directories from the $PATH
variable and print only the ones that end with an i.
How am I thinking about doing it
Problems
Any ideas on how to get over this problem,or can you think of something more appropriate.
You can use this BASH one-liner for that job:
(IFS=':'; for i in $PATH; do [[ -d "$i" && $i =~ i$ ]] && echo "$i"; done)
IFS=':'
sets input field separator to :
$PATH
is iterated in a for loop
i
using BASH regex