Hello everyone,
I am trying to read in a folder path, delimited by / and ending in COSC, and then output the last field to a file. It is supposed to match all directories that end in a course name, for example, COSC-101 or COSC201.
I am using the following lines, but it doesn't succeed:
#!/bin/sh
read coursePath
echo $coursePath | grep -w "COSC$" >/dev/null 2>&1 | grep -oE "[^/]+$" > course
Thanks in advance for any help that can be offered