How to change a command line argument in Bash? explains how to modify input arguments in bash.
But in my case, I have a dynamic set of input arguments. I don't know how many are there.
This is my command:
send url key1=value1 key2=value2 key3=value3
I want to change all of the =
signs to :
automatically. And the key=value
pairs are not limited.
How can I do that?
Here you go:
set -- "${@/=/:}"
This replaces, in every positional parameter, the first equals sign with a colon.
See Assigning to a positional parameter for further information on the set
command.