How do I replace the all string pattern in a variable using a bash shell script?
-
Also see: How do I replace the first string pattern in a variable using a bash shell script?
Usage is ${name//pattern/string}
See line 3.
declare -A MyBucketList MyBucketList=([1]="The rain in Spain stays mainly on the plain" [2]="To get to Mars you need to air" [3]="Climb Mount Everest") echo ${MyBucketList[2]//to/in}
The result. Both
to
words replaced within
$ ./associative_array.sh To get in Mars you need in air
© Lightnetics 2024