shell-base/function/comment

11 lines
264 B
Bash

#!/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"
}