Created
March 2, 2017 21:09
-
-
Save buxx/b85420dd10c67f0cb3ca8b939b5feb8c to your computer and use it in GitHub Desktop.
Add utf8 info usage at beginning of python file given as 1rst arg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
line=$(head -n 1 $1) | |
# need to be fixed below | |
if ! [ $line="# coding: utf-8" ]; then | |
printf '%s\n' "# coding: utf-8" | cat - $1 > $1.n && mv $1.n $1 | |
fi; | |
# use like: | |
# find -iname '*.py' ! -path "./venv3.5/*" -exec ./u.sh {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment