[test]
status=running
username=abc
password=123456
server = linux
[live]
status=running
username=xyz
password=09876
server=unix
The script fails here when I write ./script test server
---------- Post updated at 02:58 PM ---------- Previous update was at 02:54 PM ----------
If there is space in between server = linux the scripts fails, But the script should give the result and the last case is If i have commented the portion
for example #server=linux
then the script should consider this one
Am trying to use mail command to send mail.. But its not working in our LAN. I cant able to send any mail to other localhost.. But i can send and receive mail in my own machine.. Help me ASAP!!:wall:
Pls check this suggestion and come back with results:
SECT="$1"
ENTRY="$2"
awk 'BEGIN{FS="[= ]*"} # set field separator to any combination of "="s and " "s
/\[.*\]/ {gsub(/[][]/,""); SECTION=$0} # find the respective section between "[" and "]"
$1 == EN && SECTION==SC {print $NF} # if entry found in the respective section, output it
' EN="$ENTRY" SC="$SECT" file # make shell vars to awk vars and use "file" for input