In my ongoing herculian efforts to learn this stuff (or, rather, to progress past the very very basics in learning this stuff) I discovered the following and find it curious.
In a “find name” command:
Equals sign (“=”) following by text or quoted text works.
What is far more important is that the string that follows the ~ operator is not a text constant - it is a regular expression, so you can e.g. set that string to “e…1” when matching on the interface name and ether1 will still match (but so would e. g. ester1 or eeeee1). Why the name~ether1 (without quotes) doesn’t throw an error is beyond my understanding.
BTW, off topic, what “more precise wording” do you suggest to distinguish the command or keywords mentioned within a sentence from the rest of the sentence, given that the quotes may be part of the syntax?
It is even more fascinating that the equal sign can be followed by quoted or unquoted text while the tilda must be followed by a quoted regular expression.
BTW, off topic, what "more precise wording" do you suggest to distinguish the command or keywords mentioned within a sentence from the rest of the sentence, given that the quotes may be part of the syntax?
Thank you for asking for my suggestion to this important issue.
I need a little more clarification before thinking through more fully.
As I understand it, taking the following as an example:
In order to explain this, we might say (if we were painfully verbose):
Begin the command line with a colon immediately (i.e., without adding a space) followed by the command "foreach" (without the quotation marks), followed by a space, followed by a variable name of your choice that will be local this particular "foreach" loop, in this case named "iface," followed by a space, followed by the command parameter "in=" (without the quotation marks), immediately (without a space) followed by an open square bracket, followed immediately by a foward slash, followed immediately by the full path (starting at top level) of a command, in this case "interface" without the quotation marks), followed by a space, followed by the command named "find" (no quotes), followed by a space, followed by the an existing parameter (or is it sub-command), in this name "name" (no quotes), followed immediately with an equal sign, followed immediately by the quoted text to match, followed by a closed square bracket.
Whew -- that is a rediculous way to state the coded command above.
It would be helpful indeed to have a shorthand language to explain each part.
While I'm thinking this through some more, could you please identify the different parts below so I can use the correct terms:
:foreach
iface
in=
[
/interface
find
name
"ether1"
]
do=
{
:put
"$iface"
}
For example (and I'm sure I'm not going to score 100% on this quiz):
:foreach -- ROS command preceeded by colon
iface -- defined variable
in= -- parameter
[ -- open square brackets
/-- forward slash
interface -- top level command
find -- command
name -- command parameter
= -- equal sign
"ether1" -- quoted text
] -- closed square bracket
do= -- command
{ -- open curly bracket
:put -- ROS command preceeded by colon
"$iface" -- quoted dollar sign variable
} -- closed curly bracket
/ means “start from root” or “start from top level” and look there for the following path
interface is the path where to execute the following command
find is the command