Can not understand this script
- by Jim
Can someone help me understand this script? It is from sysconf_add and I am new to scripting.
I need to do something similar.
function add_word() {
local word=$1
local word_quoted=$2
if ! word_present; then
$debug && cp $file $tmpf
sed -i -e "${lineno} {
s/^[[:space:]]*\($var=\".*\)\(\".*\)/\1 $word_quoted\2/;
s/=\" /=\"/
}" $file
$debug && diff -u $tmpf $file
else
echo \"$word\" already present
fi
# some balancing for vim"s syntax highlighting
}