I seem to have failed at something pretty simple, in bash. I have a string variable that holds the full path to a directory. I\'d like to assign the last two di
dirname=/a/b/c/d/e IFS=/ read -a dirs <<< "$dirname" printf "%s/%s\n" "${dirs[-2]}" "${dirs[-1]}"