shell-base/modules/scripting/comment.lib

11 lines
264 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
function comment() {
[[ $# -lt 2 ]] && echo must supply pattern and file && return 1
sed -i '/'$1'/s/^#*/#/g' "$2"
}
function uncomment() {
[[ $# -lt 2 ]] && echo must supply pattern and file && return 1
sed -i '/'$1'/s/^#*//g' "$2"
}