This is to fix one of my pet peeves with gtkdialog, that is, inside <action> and <input> tags the shell input redirection operator < triggers a syntax error and aborts gtkdialog.
Traditionally this limitation is worked around with shell pipes or temporary files. Take for example an action that aims at printing the line count of /etc/passwd as a bare number without further text. This command would do wc -l < /etc/passwd but when gtkdialog sees the command, e.g. <action>wc -l < /etc/passwd</action>, it prints "gtkdialog: Error in line 1, near token 'string': syntax error" and exits. So we must rewrite the command as <action>cat /etc/passwd | wc -l</action>, which forks an additional process. Enter this commit. Now shell input redirection is valid syntax, and gtkdialog keeps going. Bash <() and <<< is also valid syntax now.
Notes about this commit
This syntax change is compatible with existing scripts simply because the new syntax could not be used before.
This syntax change is only enabled within the context of <action> and <input> tags. It would be trivial to enable it for all tags but why?
There must be at least one space between < and the / that follows because </ was and remains reserved for closing tags.
This is to fix one of my pet peeves with gtkdialog, that is, inside
<action>
and<input>
tags the shell input redirection operator<
triggers a syntax error and aborts gtkdialog.Traditionally this limitation is worked around with shell pipes or temporary files. Take for example an action that aims at printing the line count of
/etc/passwd
as a bare number without further text. This command would dowc -l < /etc/passwd
but when gtkdialog sees the command, e.g.<action>wc -l < /etc/passwd</action>
, it prints "gtkdialog: Error in line 1, near token 'string': syntax error" and exits. So we must rewrite the command as<action>cat /etc/passwd | wc -l</action>
, which forks an additional process. Enter this commit. Now shell input redirection is valid syntax, and gtkdialog keeps going. Bash<()
and<<<
is also valid syntax now.Notes about this commit
<action>
and<input>
tags. It would be trivial to enable it for all tags but why?<
and the/
that follows because</
was and remains reserved for closing tags.Test scriptlets
Notes about the gtkdialog lexer
<edit><default>
.<default>
tags but not OK in shell<action>
tags.<action>
tag results in no action and no syntax error (subtle failure point).<
. Quotes are passed to the underlying shell.