This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-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"
}