[ ... print count-only ...] -> [ :len [ ... find ... ] ]

Using 'print count-only' always prints a number to terminal, even if the
value is evaluated in a condition or assigned to a variable. This can be
quite annoying. Behavior will not chance (SUP-25503), so replacing the
code...
This commit is contained in:
Christian Hesse 2020-08-26 09:23:56 +02:00
parent 92ca31a41d
commit ff5cdc3019
20 changed files with 38 additions and 38 deletions

View file

@ -10,7 +10,7 @@ procedure please follow [the long way in detail](README.md#the-long-way-in-detai
/ tool fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/Let%27s%20Encrypt%20Authority%20X3.pem" dst-path="letsencrypt.pem"; / tool fetch "https://git.eworm.de/cgit/routeros-scripts/plain/certs/Let%27s%20Encrypt%20Authority%20X3.pem" dst-path="letsencrypt.pem";
:delay 1s; :delay 1s;
/ certificate import file-name=letsencrypt.pem passphrase=""; / certificate import file-name=letsencrypt.pem passphrase="";
:if ([ / certificate print count-only where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" or fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" or fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739" ] != 3) do={ :if ([ :len [ / certificate find where fingerprint="96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6" or fingerprint="731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568" or fingerprint="0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739" ] ] != 3) do={
:error "Something is wrong with your certificates!"; :error "Something is wrong with your certificates!";
} }
/ file remove "letsencrypt.pem"; / file remove "letsencrypt.pem";

View file

@ -21,7 +21,7 @@ $WaitFullyConnected;
:local InstalledVersion [ / system package update get installed-version ]; :local InstalledVersion [ / system package update get installed-version ];
:local Updated false; :local Updated false;
:if ([ / file print count-only where name=$PackagePath type="directory" ] = 0) do={ :if ([ :len [ / file find where name=$PackagePath type="directory" ] ] = 0) do={
$MkDir $PackagePath; $MkDir $PackagePath;
$LogPrintExit info ("Created directory at package path (" . $PackagePath . \ $LogPrintExit info ("Created directory at package path (" . $PackagePath . \
"). Please place your packages!") false; "). Please place your packages!") false;
@ -43,7 +43,7 @@ $WaitFullyConnected;
} }
:if ($Updated = true) do={ :if ($Updated = true) do={
:if ([ / system script print count-only where name="capsman-rolling-upgrade" ] > 0) do={ :if ([ :len [ / system script find where name="capsman-rolling-upgrade" ] ] > 0) do={
/ system script run capsman-rolling-upgrade; / system script run capsman-rolling-upgrade;
} else={ } else={
/ caps-man remote-cap upgrade [ find where version!=$InstalledVersion ]; / caps-man remote-cap upgrade [ find where version!=$InstalledVersion ];

View file

@ -14,7 +14,7 @@ $ScriptLock "capsman-rolling-upgrade";
:local InstalledVersion [ / system package update get installed-version ]; :local InstalledVersion [ / system package update get installed-version ];
:local RemoteCapCount [ /caps-man remote-cap print count-only ]; :local RemoteCapCount [ :len [ / caps-man remote-cap find ] ];
:if ($RemoteCapCount > 0) do={ :if ($RemoteCapCount > 0) do={
:local Delay (600 / $RemoteCapCount); :local Delay (600 / $RemoteCapCount);
:if ($Delay > 120) do={ :set Delay 120; } :if ($Delay > 120) do={ :set Delay 120; }

View file

@ -101,7 +101,7 @@ $WaitFullyConnected;
:foreach Cert in=[ / certificate find where !revoked !scep-url expires-after<2w fingerprint~"." ] do={ :foreach Cert in=[ / certificate find where !revoked !scep-url expires-after<2w fingerprint~"." ] do={
:local CertVal [ / certificate get $Cert ]; :local CertVal [ / certificate get $Cert ];
:if ([ / certificate scep-server print count-only where ca-cert=($CertVal->"ca") ] > 0) do={ :if ([ :len [ / certificate scep-server find where ca-cert=($CertVal->"ca") ] ] > 0) do={
$LogPrintExit debug ("Certificate \"" . ($CertVal->"name") . "\" is handled by SCEP, skipping.") false; $LogPrintExit debug ("Certificate \"" . ($CertVal->"name") . "\" is handled by SCEP, skipping.") false;
} else={ } else={
:local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ]; :local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ];

View file

@ -19,7 +19,7 @@
:global VersionToNum; :global VersionToNum;
:local DoUpdate do={ :local DoUpdate do={
:if ([ / system script print count-only where name="packages-update" ] > 0) do={ :if ([ :len [ / system script find where name="packages-update" ] ] > 0) do={
/ system script run packages-update; / system script run packages-update;
} else={ } else={
/ system package update install without-paging; / system package update install without-paging;
@ -27,14 +27,14 @@
:error "Waiting for system to reboot."; :error "Waiting for system to reboot.";
} }
:if ([ / system package print count-only where name="wireless" disabled=no ] > 0) do={ :if ([ :len [ / system package find where name="wireless" disabled=no ] ] > 0) do={
:if ([ / interface wireless cap get enabled ] = true && \ :if ([ / interface wireless cap get enabled ] = true && \
[ / caps-man manager get enabled ] = false) do={ [ / caps-man manager get enabled ] = false) do={
$LogPrintExit error "System is managed by CAPsMAN, not checking." true; $LogPrintExit error "System is managed by CAPsMAN, not checking." true;
} }
} }
:if ([ / system scheduler print count-only where name="reboot-for-update" ] > 0) do={ :if ([ :len [ / system scheduler find where name="reboot-for-update" ] ] > 0) do={
:error "A reboot for update is already scheduled."; :error "A reboot for update is already scheduled.";
} }

View file

@ -15,10 +15,10 @@
:global SymbolForNotification; :global SymbolForNotification;
:do { :do {
# we are not interested in output, but print without count-only is # we are not interested in output, but print is
# required to fetch information from cloud # required to fetch information from cloud
/ system backup cloud print as-value; / system backup cloud print as-value;
:if ([ / system backup cloud print count-only ] > 0) do={ :if ([ :len [ / system backup cloud find ] ] > 0) do={
/ system backup cloud upload-file action=create-and-upload \ / system backup cloud upload-file action=create-and-upload \
password=$BackupPassword replace=[ get ([ find ]->0) name ]; password=$BackupPassword replace=[ get ([ find ]->0) name ];
} else={ } else={

View file

@ -17,7 +17,7 @@
$ScriptLock "collect-wireless-mac.capsman"; $ScriptLock "collect-wireless-mac.capsman";
:if ([ / caps-man access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={ :if ([ :len [ / caps-man access-list find where comment="--- collected above ---" disabled ] ] = 0) do={
/ caps-man access-list add comment="--- collected above ---" disabled=yes; / caps-man access-list add comment="--- collected above ---" disabled=yes;
$LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false; $LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false;
} }

View file

@ -17,7 +17,7 @@
$ScriptLock "collect-wireless-mac.local"; $ScriptLock "collect-wireless-mac.local";
:if ([ / interface wireless access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={ :if ([ :len [ / interface wireless access-list find where comment="--- collected above ---" disabled ] ] = 0) do={
/ interface wireless access-list add comment="--- collected above ---" disabled=yes; / interface wireless access-list add comment="--- collected above ---" disabled=yes;
$LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false; $LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false;
} }

View file

@ -18,7 +18,7 @@
$ScriptLock "collect-wireless-mac%TEMPL%"; $ScriptLock "collect-wireless-mac%TEMPL%";
:if ([ / %PATH% access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={ :if ([ :len [ / %PATH% access-list find where comment="--- collected above ---" disabled ] ] = 0) do={
/ %PATH% access-list add comment="--- collected above ---" disabled=yes; / %PATH% access-list add comment="--- collected above ---" disabled=yes;
$LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false; $LogPrintExit warning "Added disabled access-list entry with comment '--- collected above ---'." false;
} }

View file

@ -64,7 +64,7 @@ $WaitFullyConnected;
$LogPrintExit info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false; $LogPrintExit info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
/ caps-man access-list set $AccList private-passphrase=$NewPsk; / caps-man access-list set $AccList private-passphrase=$NewPsk;
:if ([ / caps-man interface print count-only where configuration=$Configuration ] > 0) do={ :if ([ :len [ / caps-man interface find where configuration=$Configuration ] ] > 0) do={
:foreach SeenSsid in=$Seen do={ :foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={ :if ($SeenSsid = $Ssid) do={
$LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; $LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;

View file

@ -64,7 +64,7 @@ $WaitFullyConnected;
$LogPrintExit info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false; $LogPrintExit info ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false;
/ interface wireless access-list set $AccList private-pre-shared-key=$NewPsk; / interface wireless access-list set $AccList private-pre-shared-key=$NewPsk;
:if ([ / interface wireless print count-only where name=$IntName disabled=no ] = 1) do={ :if ([ :len [ / interface wireless find where name=$IntName disabled=no ] ] = 1) do={
:foreach SeenSsid in=$Seen do={ :foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={ :if ($SeenSsid = $Ssid) do={
$LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; $LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;

View file

@ -69,8 +69,8 @@ $WaitFullyConnected;
/ interface wireless access-list set $AccList private-pre-shared-key=$NewPsk; / interface wireless access-list set $AccList private-pre-shared-key=$NewPsk;
/ caps-man access-list set $AccList private-passphrase=$NewPsk; / caps-man access-list set $AccList private-passphrase=$NewPsk;
:if ([ / interface wireless print count-only where name=$IntName disabled=no ] = 1) do={ :if ([ :len [ / interface wireless find where name=$IntName disabled=no ] ] = 1) do={
:if ([ / caps-man interface print count-only where configuration=$Configuration ] > 0) do={ :if ([ :len [ / caps-man interface find where configuration=$Configuration ] ] > 0) do={
:foreach SeenSsid in=$Seen do={ :foreach SeenSsid in=$Seen do={
:if ($SeenSsid = $Ssid) do={ :if ($SeenSsid = $Ssid) do={
$LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; $LogPrintExit debug ("Already sent a mail for SSID " . $Ssid . ", skipping.") false;

View file

@ -22,7 +22,7 @@
:local Ttl 5m; :local Ttl 5m;
:local CommentPrefix "managed by dhcp-to-dns for "; :local CommentPrefix "managed by dhcp-to-dns for ";
:if ([ / ip dns static print count-only where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] = 0) do={ :if ([ :len [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] ] = 0) do={
/ ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes; / ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes;
$LogPrintExit warning "Added disabled static dns record with comment '--- dhcp-to-dns above ---'." false; $LogPrintExit warning "Added disabled static dns record with comment '--- dhcp-to-dns above ---'." false;
} }
@ -31,7 +31,7 @@
:foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={ :foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={
:local DnsRecordVal [ / ip dns static get $DnsRecord ]; :local DnsRecordVal [ / ip dns static get $DnsRecord ];
:local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ]; :local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
:if ([ / ip dhcp-server lease print count-only where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] > 0) do={ :if ([ :len [ / ip dhcp-server lease find where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] ] > 0) do={
$LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false; $LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
} else={ } else={
:local Found false; :local Found false;

View file

@ -66,7 +66,7 @@
"is configured to download certificate CRLs to system!") false; "is configured to download certificate CRLs to system!") false;
} }
:if ([ / certificate print count-only where common-name=$CommonName ] = 0) do={ :if ([ :len [ / certificate find where common-name=$CommonName ] ] = 0) do={
$LogPrintExit info ("Certificate with CommonName \"" . $CommonName . "\" not available.") false; $LogPrintExit info ("Certificate with CommonName \"" . $CommonName . "\" not available.") false;
:if ([ $CertificateDownload $CommonName ] = false) do={ :if ([ $CertificateDownload $CommonName ] = false) do={
:return false; :return false;
@ -76,7 +76,7 @@
:local CertVal; :local CertVal;
:local Issuer $CommonName; :local Issuer $CommonName;
:do { :do {
:if ([ / certificate print count-only where common-name=$Issuer ] = 0) do={ :if ([ :len [ / certificate find where common-name=$Issuer ] ] = 0) do={
$LogPrintExit info ("Certificate chain for \"" . $CommonName . \ $LogPrintExit info ("Certificate chain for \"" . $CommonName . \
"\" is incomplete, missing \"" . $Issuer . "\".") false; "\" is incomplete, missing \"" . $Issuer . "\".") false;
:if ([ $CertificateDownload $CommonName ] = false) do={ :if ([ $CertificateDownload $CommonName ] = false) do={
@ -176,7 +176,7 @@
# default route is reachable # default route is reachable
:set DefaultRouteIsReachable do={ :set DefaultRouteIsReachable do={
:if ([ / ip route print count-only where dst-address=0.0.0.0/0 !unreachable active !routing-mark ] > 0) do={ :if ([ :len [ / ip route find where dst-address=0.0.0.0/0 !unreachable active !routing-mark ] ] > 0) do={
:return true; :return true;
} }
:return false; :return false;
@ -249,7 +249,7 @@
} }
:local PkgDest [ $CleanFilePath ($PkgDir . "/" . $PkgFile) ]; :local PkgDest [ $CleanFilePath ($PkgDir . "/" . $PkgFile) ];
:if ([ / file print count-only where name=$PkgDest type="package" ] > 0) do={ :if ([ :len [ / file find where name=$PkgDest type="package" ] ] > 0) do={
$LogPrintExit info ("Package file alreasy exists.") false; $LogPrintExit info ("Package file alreasy exists.") false;
:return true; :return true;
} }
@ -383,7 +383,7 @@
:global LogPrintExit; :global LogPrintExit;
:if ([ / tool netwatch print count-only where comment=$MailServer ] = 0) do={ :if ([ :len [ / tool netwatch find where comment=$MailServer ] ] = 0) do={
$LogPrintExit warning ("Adding netwatch entry for mail server.") false; $LogPrintExit warning ("Adding netwatch entry for mail server.") false;
:local MailHost $MailServer; :local MailHost $MailServer;
:if ([ :typeof [ :toip $MailHost ] ] != "ip" ) do={ :if ([ :typeof [ :toip $MailHost ] ] != "ip" ) do={
@ -418,7 +418,7 @@
:global WaitForFile; :global WaitForFile;
:if ([ / file print count-only where name=$Dir type="directory" ] = 0) do={ :if ([ :len [ / file find where name=$Dir type="directory" ] ] = 0) do={
:local WwwVal [ / ip service get www ]; :local WwwVal [ / ip service get www ];
/ ip service set www address=127.0.0.1/32 disabled=no port=80; / ip service set www address=127.0.0.1/32 disabled=no port=80;
/ tool fetch http://127.0.0.1/ dst-path=($Dir . "/tmp"); / tool fetch http://127.0.0.1/ dst-path=($Dir . "/tmp");
@ -495,7 +495,7 @@
:global SymbolForNotification; :global SymbolForNotification;
:foreach Script in=$Scripts do={ :foreach Script in=$Scripts do={
:if ([ / system script print count-only where name=$Script ] = 0) do={ :if ([ :len [ / system script find where name=$Script ] ] = 0) do={
$LogPrintExit info ("Adding new script: " . $Script) false; $LogPrintExit info ("Adding new script: " . $Script) false;
/ system script add name=$Script source="#!rsc"; / system script add name=$Script source="#!rsc";
} }
@ -569,7 +569,7 @@
/ system script set owner=($ScriptVal->"name") source=$SourceNew \ / system script set owner=($ScriptVal->"name") source=$SourceNew \
dont-require-permissions=$DontRequirePermissions $Script; dont-require-permissions=$DontRequirePermissions $Script;
:if ($ScriptVal->"name" = "global-config" && \ :if ($ScriptVal->"name" = "global-config" && \
[ / system script print count-only where name="global-config-overlay" ] > 0) do={ [ :len [ / system script find where name="global-config-overlay" ] ] > 0) do={
$LogPrintExit info ("Reloading global configuration and overlay.") false; $LogPrintExit info ("Reloading global configuration and overlay.") false;
/ system script { run global-config; run global-config-overlay; } / system script { run global-config; run global-config-overlay; }
} }
@ -593,7 +593,7 @@
:global GlobalConfigChanges; :global GlobalConfigChanges;
:local ChangeLogCode; :local ChangeLogCode;
:local ConfigScript "global-config"; :local ConfigScript "global-config";
:if ([ /system script print count-only where name="global-config-overlay" ] > 0) do={ :if ([ :len [ / system script find where name="global-config-overlay" ] ] > 0) do={
:set ConfigScript "global-config-overlay"; :set ConfigScript "global-config-overlay";
} }
:local NotificationMessage ("Current configuration on " . $Identity . \ :local NotificationMessage ("Current configuration on " . $Identity . \
@ -645,7 +645,7 @@
:local Script [ :tostr $1 ]; :local Script [ :tostr $1 ];
:if ([ / system script job print count-only where script=$Script ] > 1) do={ :if ([ :len [ / system script job find where script=$Script ] ] > 1) do={
$LogPrintExit info ("Script " . $Script . " started more than once... Aborting.") true; $LogPrintExit info ("Script " . $Script . " started more than once... Aborting.") true;
} }
} }
@ -868,7 +868,7 @@
:local FileName [ $CleanFilePath [ :tostr $1 ] ]; :local FileName [ $CleanFilePath [ :tostr $1 ] ];
:local I 0; :local I 0;
:while ([ file print count-only where name=$FileName ] = 0) do={ :while ([ :len [ / file find where name=$FileName ] ] = 0) do={
:if ($I > 20) do={ :if ($I > 20) do={
:return false; :return false;
} }
@ -895,7 +895,7 @@
:global TimeIsSync; :global TimeIsSync;
:while ([ $TimeIsSync ] = false) do={ :while ([ $TimeIsSync ] = false) do={
:if ([ / system script print count-only where name="rotate-ntp" ] > 0 && \ :if ([ :len [ / system script find where name="rotate-ntp" ] ] > 0 && \
[ :tostr [ / system resource get uptime ] ] ~ "[369]:00\$") do={ [ :tostr [ / system resource get uptime ] ] ~ "[369]:00\$") do={
:do { :do {
/ system script run rotate-ntp; / system script run rotate-ntp;

View file

@ -13,7 +13,7 @@
:local Date [ / system clock get date ]; :local Date [ / system clock get date ];
:local PassWord [ / ip hotspot user get [ find where name=$UserName ] password ]; :local PassWord [ / ip hotspot user get [ find where name=$UserName ] password ];
:if ([ / caps-man access-list print count-only where comment="--- hotspot-to-wpa above ---" disabled ] = 0) do={ :if ([ :len [ / caps-man access-list find where comment="--- hotspot-to-wpa above ---" disabled ] ] = 0) do={
/ caps-man access-list add comment="--- hotspot-to-wpa above ---" disabled=yes; / caps-man access-list add comment="--- hotspot-to-wpa above ---" disabled=yes;
$LogPrintExit warning "Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'." false; $LogPrintExit warning "Added disabled access-list entry with comment '--- hotspot-to-wpa above ---'." false;
} }

View file

@ -8,8 +8,8 @@
:foreach Bridge in=[ / interface bridge find ] do={ :foreach Bridge in=[ / interface bridge find ] do={
:local BrName [ / interface bridge get $Bridge name ]; :local BrName [ / interface bridge get $Bridge name ];
:if ([ / interface bridge port print count-only where bridge=$BrName ] > 0) do={ :if ([ :len [ / interface bridge port find where bridge=$BrName ] ] > 0) do={
:if ([ / interface bridge port print count-only where bridge=$BrName and inactive=no ] = 0) do={ :if ([ :len [ / interface bridge port find where bridge=$BrName and inactive=no ] ] = 0) do={
/ ip address disable [ find where !dynamic interface=$BrName ]; / ip address disable [ find where !dynamic interface=$BrName ];
} else={ } else={
/ ip address enable [ find where !dynamic interface=$BrName ]; / ip address enable [ find where !dynamic interface=$BrName ];

View file

@ -7,7 +7,7 @@
:local NewVlanId 33; :local NewVlanId 33;
:if ( [ / interface ethernet switch mac-based-vlan print count-only where src-mac-address=$leaseActMAC ] = 0 ) do={ :if ([ :len [ / interface ethernet switch mac-based-vlan find where src-mac-address=$leaseActMAC ] ] = 0 ) do={
:log info ("MAC-based-VLAN: learning MAC address " . $leaseActMAC . " for VLAN " . $NewVlanId . "."); :log info ("MAC-based-VLAN: learning MAC address " . $leaseActMAC . " for VLAN " . $NewVlanId . ".");
/ interface ethernet switch mac-based-vlan add src-mac-address=$leaseActMAC new-customer-vid=$NewVlanId; / interface ethernet switch mac-based-vlan add src-mac-address=$leaseActMAC new-customer-vid=$NewVlanId;
} }

View file

@ -42,7 +42,7 @@
:delay ((1 + $leaseBound) . "s"); :delay ((1 + $leaseBound) . "s");
:foreach Script in=$Scripts do={ :foreach Script in=$Scripts do={
:if ([ / system script print count-only where name=$Script ] > 0) do={ :if ([ :len [ / system script find where name=$Script ] ] > 0) do={
:log debug ("Running script from lease-script: " . $Script); :log debug ("Running script from lease-script: " . $Script);
/ system script run $Script; / system script run $Script;
} }

View file

@ -24,7 +24,7 @@
} }
:foreach Script in=$Scripts do={ :foreach Script in=$Scripts do={
:if ([ / system script print count-only where name=$Script ] > 0) do={ :if ([ :len [ / system script find where name=$Script ] ] > 0) do={
:log debug ("Running script from ppp-on-up: " . $Script); :log debug ("Running script from ppp-on-up: " . $Script);
/ system script run $Script; / system script run $Script;
} }

View file

@ -27,7 +27,7 @@ $WaitFullyConnected;
:local Settings [ / tool sms get ]; :local Settings [ / tool sms get ];
# forward SMS in a loop # forward SMS in a loop
:while ([ / tool sms inbox print count-only ] > 0) do={ :while ([ :len [ / tool sms inbox find ] ] > 0) do={
:local Phone [ / tool sms inbox get ([ find ]->0) phone ]; :local Phone [ / tool sms inbox get ([ find ]->0) phone ];
:local Messages ""; :local Messages "";
:local Delete [ :toarray "" ]; :local Delete [ :toarray "" ];