Skip to content

Instantly share code, notes, and snippets.

@NateWeiler
Last active September 6, 2020 07:30
Show Gist options
  • Save NateWeiler/b2cec2fa25c85a7a31adb76685854be8 to your computer and use it in GitHub Desktop.
Save NateWeiler/b2cec2fa25c85a7a31adb76685854be8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# your target file
CONFIG=./config.txt
# comment target
comment() {
sed -i '' "s/^$1/#$1/" $CONFIG
}
# comment target
uncomment() {
echo $1
sed -i '' "s/^#$1/$1/" $CONFIG
}
# Use it so:
uncomment enable_uart
comment arm_freq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment