Parent folder contains subdir name appended at the end
Delimiter is underscore _
:
a_b_c (parent folder contains sub directory name at the end)
|c/ (to be deleted)
|..
d_f
|..
|f/ (to be deleted)
g_h
|h/ (to be deleted)
|..
Output should be
a_b_c (parent folder contains sub directory name at the end)
|..
d_f
|..
g_h
|..
What I have with me is get the subdirectory name
"$PWD" |rev|cut -d"_" -f1|rev (input: a_b_c output: c)
Not sure how to delete the subdirectory. Help please!