I want to extract the directory. I have used the below mentioned shell script.
line='create word=/some/directory/name'
dir=${${${line##*=}#"'"}%"'"}
Though, it is working for me, I want to know the working of the 2nd line. How exactly string split occur in the shell scripting.
bash: ${${${line##*=}#"'"}%"'"}: bad substitution${line##*=}is sufficient: the single quotes are removed by the shell, so they are not part of the value in $line${line##*=}and echoed the value. The echoed string contained single quotes. I am not sure if these quotes are internally removed while using the string.echo ${line##*=}does not display any single quotes for me. You must have been doing something different.