Skip to content

Instantly share code, notes, and snippets.

@kojiromike
Last active August 29, 2015 14:06
Show Gist options
  • Save kojiromike/dc9c914194a4c234446e to your computer and use it in GitHub Desktop.
Save kojiromike/dc9c914194a4c234446e to your computer and use it in GitHub Desktop.
Dealing with unwieldy filenames in the shell
$ printf -v filename '"%s" - "%s".epub' "Alice's Adventures in Wonderland" 'Carrol, Lewis'
$ printf '[%s]\n' "$filename"
["Alice's Adventures in Wonderland" - "Carrol, Lewis".epub]
$ >> "$filename"
$ ls
"Alice's Adventures in Wonderland" - "Carrol, Lewis".epub
$ for f in *; do printf '[%s]\n' "$f"; done
["Alice's Adventures in Wonderland" - "Carrol, Lewis".epub]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment