LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   listen-on syntax error in bash (https://www.linuxquestions.org/questions/linux-newbie-8/listen-on-syntax-error-in-bash-4175674159/)

Shamulonga 04-28-2020 03:51 PM

listen-on syntax error in bash
 
I tried to run the following command after editing named.conf file :
$ listen-on { 127.0.0.1; 192.168.100.6; };

It returned the following error message:
-bash: syntax error near unexpected token `}'

Can anyone help resolve this error?

Thank you

rtmistler 04-28-2020 04:24 PM

Welcome to LQ,

I can't find a listen-on command anywhere.

Have you tried to modify the syntax?

It's complaining about the area near the close bracket.

Have you tried removing the semicolon at the end of it all? Or the semicolon after the last IP address?

redd9 04-28-2020 04:37 PM

What do you get from
Code:

named-checkconf

ehartman 04-29-2020 04:20 AM

Quote:

Originally Posted by Shamulonga (Post 6116979)
I tried to run the following command after editing named.conf file :
$ listen-on { 127.0.0.1; 192.168.100.6; };

It returned the following error message:
-bash: syntax error near unexpected token `}'

Escape both {} chars, as well as the ; ones with a backslash, they are special to the shell. So
Code:

$ listen-on \{ 127.0.0.1\; 192.168.100.6\; \};
BTW: the last ; isn't needed, you are already at the end of the line.
But the previous ones would break your single command into multiple ones, so that the last } becomes a command of its own.


All times are GMT -5. The time now is 06:48 AM.