【发布时间】:2021-10-22 13:16:59
【问题描述】:
我是 bash 新手,在这个问题上需要帮助。
#!/bin/bash
str="This Is My Bash String"
mod="-val"
# Loop through characters of str. If index is 0, insert mod at position 0. And if the current index contains space (" "), then insert mod after the space.
echo -e str
# This should output: -valThis -valIs -valMy -valBash -valString
我怎样才能做到这一点?
【问题讨论】: