Linux-替换文件名中的空格

问题描述:

我的文件夹中有许多文件,我想用下划线替换所有文件名中的每个空格字符。我该如何实现?

I have a number of files in a folder, and I want to replace every space character in all file names with underscores. How can I achieve this?

这应该做到:

for file in *; do mv "$file" `echo $file | tr ' ' '_'` ; done