I am trying to split a string using IFS looking at examples provided at many places. I want to get last element of the array after split, I am doing following to achieve goal :
IFS='/' read -ra split_path <<< "$path_to_file";
Bash 3.x does not understand -1 to mean the last element of an array. You want
Notice also the quoting.
As others have pointed out,
basename might be a better run for your money, or