I have I symlink
named CURRENT
pointing to a directory , lets say
CURRENT -> $HOME/local/java/jdk1.8.0
I want to extract the jdk1.8.0
part as a string.
First, I get the directory by :
current_dir= $(readlink -f $CURRENT)
And then, I tried to extract the last part of the path :
last_part= ${current_dir##*/}
or even when I try to print it via :
echo $current_dir
I get this error:
bash: /home/tarrsalah/local/java/jdk1.8.0: Is a directory
How can I convert a directory to a string ?