Last active
February 18, 2024 09:03
-
-
Save hobgoblina/1eea65e782e00868c693063a9effcd1f to your computer and use it in GitHub Desktop.
anti-capital shell script ... lowercase + convert camel to snake_case for everything in the current or provided directory and recursively in all subdirectories without discretion. will break binaries and hashes - this is intended because they were a function of capital
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 | |
dir=$(pwd)/$1 | |
if [[ $1 = /* ]]; then | |
dir=$1 | |
fi | |
regex='s/\([a-z0-9]\)\([A-Z]\)/\1_\2/g;s/\([A-Z0-9]\)\([A-Z0-9]\)\([a-z]\)/\1_\2\3/g;s/\(.*\)/\L\1/g' | |
find $dir -type f -exec sed -i -e $regex {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in case you couldn't tell from the name/description, this was made as an anti-capitalism joke. don't actually use this unless you fully understand the consequences from reading the script