Last active
December 29, 2017 07:18
-
-
Save jimyang2008/e56692a9402634fb674ad062588af86c to your computer and use it in GitHub Desktop.
Replace color names defined in .Xresources for older version of xrdb
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 | |
err() { | |
echo "ERROR: $@" >&2 | |
} | |
: ${INFILE:="$HOME/.Xresources"} | |
if [[ $# -gt 0 ]] | |
then | |
INFILE=$1 | |
fi | |
test -e $INFILE || { | |
err "input file '$INFILE' not exist" | |
exit 1 | |
} | |
sed_commands=$(awk '/#define / {printf "-e 's/%s/%s/g' ",$2,$3; }' $INFILE) | |
sed -e '/#define /d' -e '/!!/n' $sed_commands $INFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment