Community discussions

MikroTik App
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

2 commands in one line

Wed Jan 25, 2023 10:35 am

Hello,

This is my first post here and I am beginner in the Mikrotik world so please be patient with me.

I am trying to make the following command work:
/ip dhcp-client add interface=ether1 disabled=no; quit;
basically just configure dhcp on ether1 and disconnect in one line. I've read 2 other topics on this but it seems that this sequence does not work for me.
I am using CHR 7.7(but should work on generic mikrotik OS). The commands executes but does not quit, how to achieve this?

Thanks
Last edited by dragosp on Wed Jan 25, 2023 10:40 am, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: 2 commands in one line

Wed Jan 25, 2023 10:40 am

why quit?
Just close terminal....
Last edited by rextended on Wed Jan 25, 2023 10:42 am, edited 2 times in total.
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

Re: 2 commands in one line

Wed Jan 25, 2023 10:41 am

why quit?
Just close terminal....
I am scripting this from outside mikrotik and I need a clean exit preferably.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: 2 commands in one line

Wed Jan 25, 2023 10:42 am

And why no-quit would be a dirty exit? Where did you read it?

But on that line I don't see any errors, except the missing ":" before quit.
But it's only relevant if the script line is executed within a more complex script or after some previous commands.
 
nescafe2002
Forum Veteran
Forum Veteran
Posts: 897
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: 2 commands in one line

Wed Jan 25, 2023 10:55 am

Doesn't CHR add a DHCP client automatically?
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

Re: 2 commands in one line

Wed Jan 25, 2023 10:55 am

And why no-quit would be a dirty exit? Where did you read it?

But on that line I don't see any errors, except the missing ":" before quit.
But it's only relevant if the script line is executed within a more complex script or after some previous commands.
I've just seen it, its trashing my bash terminal.
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

Re: 2 commands in one line

Wed Jan 25, 2023 10:56 am

Doesn't CHR add a DHCP client automatically?
Yes but I want my script to work for other router os images too.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: 2 commands in one line

Wed Jan 25, 2023 10:57 am

And why no-quit would be a dirty exit? Where did you read it?

But on that line I don't see any errors, except the missing ":" before quit.
But it's only relevant if the script line is executed within a more complex script or after some previous commands.
I've just seen it, its trashing my bash terminal.
Do you add the : as suggested?
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

Re: 2 commands in one line

Wed Jan 25, 2023 11:21 am



I've just seen it, its trashing my bash terminal.
Do you add the : as suggested?
Yes, not working:
/ip dhcp-client add interface=ether1 disabled=no; :quit;
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: 2 commands in one line

Wed Jan 25, 2023 12:13 pm

Not working?

What you obtain on terminal, and what you exactly expect?
 
dragosp
just joined
Topic Author
Posts: 6
Joined: Wed Jan 25, 2023 10:30 am

Re: 2 commands in one line

Thu Jan 26, 2023 5:02 pm

Not working?

What you obtain on terminal, and what you exactly expect?
I will come back a little later, I had an error in my script. I need to fix it and come back to reply later.

Who is online

Users browsing this forum: No registered users and 28 guests