I have a variable which contains the current directory including several parents. For example:
$ pwd
/Users/simont/repositories
$ echo $current
~/repositories
I can strip everything except the current directory from this question:
onlycurrent=${$(current)##*/}
I want to do the opposite: remove the current dir from this variable (so that it only contains ~/
). How can I do this?