<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Rechner in der Bash]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>es gab doch in der Linux Shell ein Rechenprogramm. Das hat man gestartet und man konnte dann 3+4 und Enter eingeben und hat dann 7 in der nächsten Zeile erhalten. Wie hieß das? Geht das vielleicht auch einfacher? Ohne die Bash zu verlassen? Also:<br />
$ myprg 3+4<br />
7<br />
$</p>
<p>Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/252610/rechner-in-der-bash</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 21:02:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/252610.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Oct 2009 10:23:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:23:19 GMT]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>es gab doch in der Linux Shell ein Rechenprogramm. Das hat man gestartet und man konnte dann 3+4 und Enter eingeben und hat dann 7 in der nächsten Zeile erhalten. Wie hieß das? Geht das vielleicht auch einfacher? Ohne die Bash zu verlassen? Also:<br />
$ myprg 3+4<br />
7<br />
$</p>
<p>Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796260</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796260</guid><dc:creator><![CDATA[-----]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:23:19 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:32:42 GMT]]></title><description><![CDATA[<p>bc</p>
<p>edit: Und wenn man's von der Kommandozeile benutzen will, leitet man halt die Standardeingabe entsprechend um, zum Beispiel so:</p>
<pre><code>echo '5*7' | bc
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1796264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796264</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:32:42 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:25:40 GMT]]></title><description><![CDATA[<p>calc oder bc</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796265</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:25:40 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:41:13 GMT]]></title><description><![CDATA[<pre><code>myprg $((3+4))
</code></pre>
<p><a href="http://tldp.org/LDP/abs/html/arithexp.html" rel="nofollow">http://tldp.org/LDP/abs/html/arithexp.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796275</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:41:13 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:40:09 GMT]]></title><description><![CDATA[<p>Für simple Rechnungen gibt es auch die arithmetic expansion: $(( 1 + 2 ))<br />
oder: expr 1 + 2</p>
<p>Vorteil: expr bzw. arithmetic expansion funktionieren in einer bash-shell immer, bc oder calc muss man erst installieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796276</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:40:09 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:41:41 GMT]]></title><description><![CDATA[<p>bc war was ich gesucht habe. calc ist jedoch viel besser. &quot;calc 3+7&quot; geht nämlich auf der Shell.</p>
<p>Vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796279</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796279</guid><dc:creator><![CDATA[------]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:41:41 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:43:42 GMT]]></title><description><![CDATA[<p>Stimmt, &quot;echo $((156/5))&quot; geht auch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796281</guid><dc:creator><![CDATA[-----]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:43:42 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 10:46:56 GMT]]></title><description><![CDATA[<p>----- schrieb:</p>
<blockquote>
<p>Stimmt, &quot;echo $((156/5))&quot; geht auch.</p>
</blockquote>
<p>Statt &quot;echo $((156/5))&quot; geht auch &quot;expr 156 / 5&quot;, was manchmal einfacher zu lesen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796283</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Thu, 22 Oct 2009 10:46:56 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 11:27:41 GMT]]></title><description><![CDATA[<p>Ich verwend Python. Auszug aus meiner .bashrc:</p>
<pre><code>? () { python -c &quot;print $*&quot;; }
</code></pre>
<p>damit geht dann:</p>
<pre><code>$ ? 2+3
5
$ ? 2**5
32
$ ? &quot;[x**2 for x in range(10)]&quot;
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1796310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796310</guid><dc:creator><![CDATA[Blue-Tiger]]></dc:creator><pubDate>Thu, 22 Oct 2009 11:27:41 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 11:30:08 GMT]]></title><description><![CDATA[<p>Blue-Tiger schrieb:</p>
<blockquote>
<p>Ich verwend Python. Auszug aus meiner .bashrc:</p>
<pre><code>? () { python -c &quot;print $*&quot;; }
</code></pre>
<p>damit geht dann:</p>
<pre><code>$ ? 2+3
5
$ ? 2**5
32
$ ? &quot;[x**2 for x in range(10)]&quot;
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
</blockquote>
<p>erinnert mich an BASIC damals, da ging das auch <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796314</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Thu, 22 Oct 2009 11:30:08 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 12:22:35 GMT]]></title><description><![CDATA[<p>Blue-Tiger schrieb:</p>
<blockquote>
<p>Ich verwend Python. Auszug aus meiner .bashrc:</p>
<pre><code>...
$ ? &quot;[x**2 for x in range(10)]&quot;
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
</blockquote>
<p>Kann man da eigentlich irgendwie die Anführungszeichen los werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796344</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796344</guid><dc:creator><![CDATA[µngbd]]></dc:creator><pubDate>Thu, 22 Oct 2009 12:22:35 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 13:15:27 GMT]]></title><description><![CDATA[<p>------ schrieb:</p>
<blockquote>
<p>bc war was ich gesucht habe. calc ist jedoch viel besser. &quot;calc 3+7&quot; geht nämlich auf der Shell.</p>
<p>Vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
</blockquote>
<p>calc ist bei meinem System nicht installiert, aber bc ist eigentlich ueberall dabei. Wie bc mit Kommandpziele funzt, wurde aber schon gesagt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796369</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Thu, 22 Oct 2009 13:15:27 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 13:17:18 GMT]]></title><description><![CDATA[<p>µngbd schrieb:</p>
<blockquote>
<p>Blue-Tiger schrieb:</p>
<blockquote>
<p>Ich verwend Python. Auszug aus meiner .bashrc:</p>
<pre><code>...
$ ? &quot;[x**2 for x in range(10)]&quot;
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
</blockquote>
<p>Kann man da eigentlich irgendwie die Anführungszeichen los werden?</p>
</blockquote>
<p>Die bash will die Klammern selbst parsen, wenn du die escapst gehts:</p>
<pre><code>$ ? [x**2 for x in range\(10\)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
</code></pre>
<p>Vllt. auch noch witzig: Wenn man die Zeile umaendert kann man mathematische Funktionen/Konstanten verwenden:</p>
<pre><code>? () { python -c &quot;from math import *; print $*&quot;; }
</code></pre>
<p>Dann klappt auch</p>
<pre><code>$ ? &quot;sin(pi/2)&quot;
1.0
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1796373</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796373</guid><dc:creator><![CDATA[Blue-Tiger]]></dc:creator><pubDate>Thu, 22 Oct 2009 13:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 15:48:56 GMT]]></title><description><![CDATA[<p>Blue-Tiger schrieb:</p>
<blockquote>
<p>Die bash will die Klammern selbst parsen, wenn du die escapst gehts:<br />
[...]</p>
</blockquote>
<p>Daran liegts!</p>
<p>Schade eigentlich. Die Sache gefällt mir aber auch so.<br />
Die Anführungszeichen werd ich schon noch los...</p>
<p>Hmm, aber blöd eigentlich: wenn es ein <code>$*</code> gibt, dann hat die Bash die Zeile (und damit die Klammern) schon geparst. Kann man die nicht irgendwie ein wenig more lazy machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796475</guid><dc:creator><![CDATA[mngbd]]></dc:creator><pubDate>Thu, 22 Oct 2009 15:48:56 GMT</pubDate></item><item><title><![CDATA[Reply to Rechner in der Bash on Thu, 22 Oct 2009 17:45:17 GMT]]></title><description><![CDATA[<p>Blue-Tiger schrieb:</p>
<blockquote>
<p>Ich verwend Python. Auszug aus meiner .bashrc:</p>
<pre><code>? () { python -c &quot;print $*&quot;; }
</code></pre>
</blockquote>
<p>sehr nette Idee. Bei zsh könnte man zumindest noch mit noglob die wildcard-auswertung ausstellen. Ich hoffe es gibt auch etwas ähnliches, dass den anderen krempel wie ()?!&amp; unterdrückt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1796583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1796583</guid><dc:creator><![CDATA[DrGreenthumb]]></dc:creator><pubDate>Thu, 22 Oct 2009 17:45:17 GMT</pubDate></item></channel></rss>