You can do it using only the shell, no need for tr or sed
$ str="This is just a test"
$ echo ${str// /_}
This_is_just_a_test
You can do it using only the shell, no need for tr or sed
$ str="This is just a test"
$ echo ${str// /_}
This_is_just_a_test