Created
July 22, 2013 18:20
-
-
Save fungusakafungus/6056205 to your computer and use it in GitHub Desktop.
Use `type` builtin to format bash code. Give it a bash file as an argument, it will overwrite it with formatted bash. Kinda useful for one-liners, but adds useless semicolons and strips comments. At least.
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 | |
eval "function $1() { $(cat $1); }"; | |
type $1 2>&1 | sed -n 's#^ ##p' > "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment