PDA

View Full Version : [SOLVED] BASH String Manipulation



blendmaster
November 24th, 2008, 03:13 AM
Hello!

I'm stuck in the middle of one of my scripts. This is my code:


fixed_Artist=${"${album_Data[0]}"//\//-}

I'm trying to take the first string in the array album_Data and replace any instance of "/" with "-". However, I keep getting a "bad substitution" error.

What exactly is wrong with my code?

Thanks!

geirha
November 24th, 2008, 03:23 AM
Try with

fixed_Artist=${album_Data[0]//\//-}

blendmaster
November 24th, 2008, 03:28 AM
Try with

fixed_Artist=${album_Data[0]//\//-}

Thanks a ton! :)

I'm still learning BASH concepts, so it's still a little weird to me.