<p>There is some problem with Geany's context action command that is revealed by the following example.</p>
<p>Let's make a simple /home/me/sh1 executable file containing:</p>
<pre><code>1  #! /bin/bash
2  echo "$1" "$2" "$3"
3  read
</code></pre>
<p>and set the context action command as:<br>
<code>xterm -e /home/me/sh1 $2 $3 "%s"</code></p>
<p>Now not going too far, let's select line <a href="https://github.com/geany/geany/pull/2" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="1869766" data-permission-text="Issue title is private" data-url="https://github.com/geany/geany/issues/2">#2</a> of our sh1 and run the context action command.<br>
We'll get in xterm:<br>
<code>$2 $3 echo $1 $2 $3</code><br>
while indeed we waited the following:<br>
<code>$2 $3 echo "$1" "$2" "$3"</code></p>
<p>To get it we should select the text with quotes escaped:<br>
<code>echo \"$1\" \"$2\" \"$3\"</code></p>
<p>Reason of all this mess is that Geany doesn't escape quotes in itself.<br>
The internal Geany code swallows quotes of %s.</p>
<p>Moreover, if we select "$ in our text then we'll get nothing.<br>
By this we'll totally confuse Geany.</p>
<p>Any odd number of " in selected text will do the same.</p>
<p>By the way, to process this sentence with context command we should write it as:<br>
<code>Any odd number of \" in selected text will do the same.</code><br>
but writing and selecting it quoted:<br>
<code>"Any odd number of \" in selected text will do the same."</code><br>
we'll get<br>
<code>$2 $3 Any</code><br>
(after internal stripping all non-escaped quotes $3 parameter of sh1 will get "Any", $4 "odd", $5 "number" ...).</p>
<p>All this is not so good.<br>
Geany should not modify any selected text any way.<br>
It's for us stupid users to use any number of quotes and other stuff in processed text.</p>
<hr>
<p>2nd issue is in "Compile/ Build/ Run settings".</p>
<p>If we set the Run command (let it be so dull, heh):<br>
<code>xterm -e /home/me/sh1 $2 $3 "%s"</code><br>
and press F5, all we get in xterm is:<br>
<code>%s</code><br>
Geany swallows all $ when they are followed by a number or a letter.<br>
It takes them internally for some parameters and substitutes them in Run command with spaces.</p>
<p>Quoting them as in<br>
<code>xterm -e /home/me/sh1 "$2" "$3" "%s"</code><br>
doesn't help as well.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1801">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-OAYSXssFEFPLjR4HDfxprlyqN6ks5td7zogaJpZM4Somkz">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ0ZO8KrIkLonR8Ey51c3Iw9st5aKks5td7zogaJpZM4Somkz.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/1801"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Internal problem of Geany's context action \u0026 Run/Compile/Build commands (#1801)"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1801"}}}</script>