I have a directory called windows which contains files with names containing spaces. I want to replace the spaces in file names with underscores _. I need to correct all file names in the windows directory.
Constraints:
- I'm allowed only one command.
- Solutions must not contain control structures (if, while, for, etc.).
- Solutions must not contain command substitutions $(...), special characters like ;, &, &&, ${}, ||, etc.
I'm looking for a solution that respects all the constraints mentioned above. Any help or guidance would be greatly appreciated. Thank you!
Use the built-in
-regexcondition to match the filenames, instead of piping togrep.Use the built-in
-execoperator to execute thebashcommand to perform the filename substitution andmvcommand.Use
sedin a command substitution to perform the space replacements.