Exec Binding: Colon character in commandline to execute

Hello everybody,

I am trying to use the Exec Binding for the first time and just ran into an issue:

My command line contains colon characters because I have to pass a MAC address to a check-script:

Number Stephans_iPhone_last_seen_secs “Stephan’s iPhone zuletzt gesehen vor [%.0f Sekunden]” <man_1> { exec="<[/usr/local/get_mtime_diff.sh ab:cd:ef:gh:ij:k:1000:]" }

Obviously this doesn’t work because the colon is also the separation character. I tried to put the commandline into ’ ’ and also tried to escape the colons in the commandline with an backslash character ( : ) but both didn’t work. Is there a safe way to use colons in the commandline?

Thanks in advance for your help!

regards,
Stephan

EDIT: Just reread your post - not enough coffee this morning…

What is the separator a “:” for - can you change your script to accept a different separator?

Hi jflarante,

thanks for your answer. Of course I could use replace the ususal MAC-address separator “:” with some other charakter and re-replace it with “:” in the script that is executed (I exactly need the colon notation in the script).
But I did hope that there would be a “clean” way to deal with colons in the command line (E.G. escaping the colons somehow), but that doesn’t seem to be the case, so I will do it the dirty way that you described. :wink:

Thanks for your help!

regards,
Stephan

I thought you could replace the colon separators between the other items
rather that in the MAC address.

OK, but how? I guess that’s a fixed separator in the binding, isn’t it?

Sorry I didn’t look closely enough.

What about if you defined MAC addresses in the script and pass in a constant name in the .items file? Might make it cleaner than putting mac address in semicolon?

Number Stephans_iPhone_last_seen_secs "Stephan's iPhone zuletzt gesehen vor [%.0f Sekunden]" { exec="<[/usr/local/get_mtime_diff.sh StephaniPhoneMac:k:1000:]" }

Looking at the wiki I’m surprise the single quotes or the escape “” didn’t work!

Sorry I couldn’t be of more help.