[SOLVED] Bad substitution
by GPGAgent from LinuxQuestions.org on (#575BT)
I can't get my head around this one:Code:jonke@charlie:~$ d=$(pwd)
jonke@charlie:~$ echo $d
/home/jonke
jonke@charlie:~$ d=${d##*/}
jonke@charlie:~$ echo $d
jonke
jonke@charlie:~$ echo ${$(pwd)##*/}
bash: ${$(pwd)##*/}: bad substitution
jonke@charlie:~$I want to avoid using the variable d, and just use the syntax directly in my script.
Basically it just gets the directory name.


jonke@charlie:~$ echo $d
/home/jonke
jonke@charlie:~$ d=${d##*/}
jonke@charlie:~$ echo $d
jonke
jonke@charlie:~$ echo ${$(pwd)##*/}
bash: ${$(pwd)##*/}: bad substitution
jonke@charlie:~$I want to avoid using the variable d, and just use the syntax directly in my script.
Basically it just gets the directory name.