This commit is contained in:
Hans Karlinius
2024-12-03 03:05:17 +01:00
parent 7e25ea88a9
commit 443a2366db
3 changed files with 16 additions and 6 deletions

View File

@@ -3,4 +3,4 @@
file="/config/vhclient.ini"
touch $file
awk -f vh_editini.awk -v section=$1 -v key=$2 -v value=$3 $file
awk -f /usr/bin/vh_editini.awk -v section=$1 -v key=$2 -v value=$3 $file

View File

@@ -1,13 +1,23 @@
#!/usr/bin/awk -f
BEGIN {
found_section = false;
found_section = 0;
found_key = 0;
}
0$ ~ "^\[" $section {
found_section = true;
$0 ~ "^\\[" section "\\]" {
found_section = 1;
}
$0 ~ "^\\[" key "\\]" {
if (found_section)
found_key = 1;
}
/.*/ {
print $0;
}
END {
print "Found section: $found_section";
print "Found section: " section " " found_section " and " key " " found_key;
}