One aid in doing the type of script you are doing is to let the MT tell you how to do it.
Set it up with numbers in Winbox
on the command line, go to the section you are working on and do and export compact.
So,
ip dhcp-server
export compact

this will show you the syntax for the command. Makes it easier to find things like that network vs address error.

On 7/8/2014 7:30 PM, Josh Luthman wrote:
Oh I see, a new variable.  I was thinking command.  NP.


Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373


On Tue, Jul 8, 2014 at 7:19 PM, Paul McCall <[email protected]> wrote:

I wanted to shorten some long string joins...

Figured it out...

  :global cat whiskers
  :global dog longtail
:global mutt ($cat." ".$dog)
:put $mutt
whiskers longtail

Thanks for your help Josh!


-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Josh Luthman
Sent: Tuesday, July 08, 2014 7:15 PM
To: Mikrotik discussions
Subject: Re: [Mikrotik] Variable problems

Wouldn't you just do "$cat $dog" ?


Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373


On Tue, Jul 8, 2014 at 7:11 PM, Paul McCall <[email protected]> wrote:

Josh,

Yep, that mistake on the network is all that was.

I still need to figure out how to store a variable that is
concatenated together

:global cat whiskers
:global dog longtail
:global mutt   (need syntax to combine the string values of $cat and $dog
with some text like " &" in between

-----Original Message-----
From: [email protected] [mailto:
[email protected]] On Behalf Of Josh Luthman
Sent: Tuesday, July 08, 2014 6:59 PM
To: Mikrotik discussions
Subject: Re: [Mikrotik] Variable problems

Oh wait, duh.  You're using dhcp-server network.  Your network should
be
192.168.1.0/24 not 192.168.1.1/24 (it's the network, not the IP).


Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373


On Tue, Jul 8, 2014 at 6:56 PM, Josh Luthman
<[email protected]>
wrote:

You don't use netmask=$LANSubnet in /ip addr

The variable becomes irrelevant, too


Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373


On Tue, Jul 8, 2014 at 6:53 PM, Paul McCall <[email protected]> wrote:

I am writing a script to configure customer CPE (Tiks) and this is
my first time using variables.  Almost all of the script is working
as expected, with a couple exceptions

I have these variables defined...

:global LANAddress  192.168.1.1/24
:global LANSubnet 24
:global LANGateway 192.168.1.1

And this is part of the script that fails.... I get "invalid network"
when I use any of the  variables in this section.  I don't
understand why

/ip dhcp-server network
add address=$LANAddress dns-server=4.2.2.2,4.2.2.3 \
domain=yourdomain.net gateway=$LANGateway netmask=$LANSubnet

2nd part of the "problem" is building or concatenating strings to a
new variable.

For Instance if I wanted to "build" the LANAddress (192.168.1.1/24)
from the LANGateway (192.168.1.1) and add a "/" then add the
LANSubnet (24) I cant seem to figure it out.

I was thinking something like this, but it doesn't work:
:global COMBINEDVAR $ LANGateway . $ LANSubnet

Any suggestions  on these two "issues" ?



Paul McCall, Pres.
PDMNet / Florida Broadband
658 Old Dixie Highway
Vero Beach, FL 32962
772-564-6800 office
772-473-0352 cell
www.pdmnet.com<http://www.pdmnet.com/>
[email protected]<mailto:[email protected]>

-------------- next part -------------- An HTML attachment was
scrubbed...
URL: <
http://mail.butchevans.com/pipermail/mikrotik/attachments/20140708/
97
8b3f11/attachment.html
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS


-------------- next part -------------- An HTML attachment was
scrubbed...
URL: <
http://mail.butchevans.com/pipermail/mikrotik/attachments/20140708/a8f
11175/attachment.html
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS _______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
http://mail.butchevans.com/pipermail/mikrotik/attachments/20140708/925e0b3a/attachment.html
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
RouterOS

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.butchevans.com/pipermail/mikrotik/attachments/20140708/f4d0a0da/attachment.html>
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4592 / Virus Database: 3986/7817 - Release Date: 07/08/14



--
Scott Reed
Owner
NewWays Networking, LLC
Wireless Networking
Network Design, Installation and Administration
Mikrotik Advanced Certified
www.nwwnet.net
(765) 855-1060  (765) 439-4253  Toll-free (855) 231-6239


_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to