Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 04-15-2021, 10:46 AM
BjoernH BjoernH is offline
Registered User
Join Date: Mar 2018
Posts: 55
Keep getting syntax error message from new MENUITEM

Good day.

I'm baffled as to why I keep getting a syntax error from this menu item I added to the menu file.

MENUITEM "&Show IPv4 addresses (all VMs)" , "SEND" , "for  i in {5,6} {8..9}; do echo "";  ssh -q -o "StrictHostKeyChecking no" 192.168.210.$i "uname -n;/usr/sbin/ip a| grep 'inet ' | grep -v host | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -v 255$";done\n"
The only way I can get it to launch with the new menu item is when I omit the double-quotes preceding 'uname' and after the '255$'. But that compromises the command after 'uname -n'.

Please advise.

Reply With Quote
Old 04-20-2021, 10:14 AM
cboyack cboyack is offline
VanDyke Technical Support
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 132
Hi Bjoernh,

I'm so sorry that this reply is coming so late. I had a response all queued up last week and I must have forgotten to actually post the response. So, here it is:

If you wish to include a special character such as a double quote ("), single quote ('), or backslash (\) in a command string, the octal code for the character should be used instead of the character. Here are the octal codes for those three characters:
  • \042 - double quote
  • \047 - single quote
  • \134 - backslash (escaping it via \\ works as well)
Making the necessary changes to your suggested menu item would make it look like this:

MENUITEM "&Show IPv4 addresses (all VMs)" , "SEND" , "for  i in {5,6} {8..9}; do echo \042\042;  ssh -q -o \042StrictHostKeyChecking no\042 192.168.210.$i \042uname -n;/usr/sbin/ip a| grep \047inet \047 | grep -v host | grep -Eo \047[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\047 | grep -v 255$\042;done\n"
Does making those changes allow the Menu item to work as desired?

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 02:47 PM.