Background
I would like to take the following string from /etc/default/hostapd and add a certain value after the =:
#DAEMON_CONF="" -> DAEMON_CONF="/etc/hostapd/hostapd.conf"
Test
un_comment_and_add_value() {
file="$1"
given_str="$2" ##DAEMON_CONF=""
value="$3" # /etc/hostapd/hostapd.conf
#dont know where to put this in the 'sed' cmd
sed -i "/$given_str/s/^#//g" "$file"
}
un_comment_and_add_value "/etc/default/hostapd" "#DAEMON_CONF=\"\"" "/etc/default/hostapd"
example.txtcan have multiple#(comments) inside of it. I only want to target#DAEMON_CONF="". – Nicholas Adamou Jan 12 '18 at 14:32