Skip to content

Instantly share code, notes, and snippets.

@jktravis
Last active October 13, 2015 20:48
Show Gist options
  • Save jktravis/4254304 to your computer and use it in GitHub Desktop.
Save jktravis/4254304 to your computer and use it in GitHub Desktop.
Pipe in or supply a single filename to remove the spaces
#!/bin/bash
# Replace spaces with underscores
for file in "${1}";
do
echo Renaming "$file" to "${file// /_}"
mv "$file" "${file// /_}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment