I am new to bash scripting. Is it possible to get a value returned on a nested variable? At the command line, the following code will generate desired ouput:
while read line; do echo -e "${line:21}"; done < Albums-linux.txt
It takes a list of directories for albums and returns a substring of GroupName/albumName. For the next step, I want the result to replace the '/' with '-' I think my syntax should be something like"
while read line; do echo -e "${"${line:21}"///-}"; done < Albums-linux.txt
so the output is GroupName-albumName. But I get a result: ${"${line:21}"///-}: bad substitution
I also tried escaping the '/' I wish to substitute by escaping it `${"${line:21}"/\//-}
but still had the same result.
Am I trying to do too much at the command line and I have to write this in a script?