Let say I have an array $Info whose elements are ;
! total energy = -1090.13343774 Ry
! total energy = -1090.20757070 Ry
! total energy = -1090.24296462 Ry
! total energy = -1090.25563488 Ry
! total energy = -1090.27085564 Ry
! total energy = -1090.27693129 Ry
! total energy = -1090.28213580 Ry
! total energy = -1090.29131927 Ry
and I want to take its last element , split it with spaces and give to an another array $LastInfo. How can I do that ?
I tried this;
lst=$((${#Info[@]} -1))
IFS=' ' LastInfo=($en[$lst])
But as posted in here the code doesn't work.
man cut
.