Suppose I want to replace the nth letter of some string, how can I do that?
I tried something like this but it's not correct:
#!/bin/bash
index= # let say 2
s='Hello'
echo ${s/$index/'a'} # This should print Healo
|
feedback
|
|
There is a Advanced Bash-Scripting Guide that shows you how to do substring and concatenation. Let's say:
| ||||
feedback
|