<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
					xmlns:content="http://purl.org/rss/1.0/modules/content/"
					xmlns:wfw="http://wellformedweb.org/CommentAPI/"
					xmlns:atom="http://www.w3.org/2005/Atom"
				  >
<channel>
<atom:link rel="self"  type="application/rss+xml"  href="http://rulinux.net/rss_from_sect_4_subsect_6_thread_5256"  />
<title>rulinux.net - Форум - Development - [bash]конкатенация имени переменной</title>
<link>http://rulinux.net/</link>
<description><![CDATA[Портал о GNU/Linux и не только]]></description>
<image><title>rulinux.net - Форум - Development - [bash]конкатенация имени переменной</title>
<link>http://rulinux.net/</link>
<url>http://rulinux.net/rss_icon.png</url>
</image>
<item>
<title>Re: [bash]конкатенация имени переменной</title>
<link>https://rulinux.net/message.php?newsid=5256&amp;page=1#33111</link>
<guid>https://rulinux.net/message.php?newsid=5256&amp;page=1#33111</guid>
<pubDate>Mon, 23 Nov 2009 20:34:32 +0300</pubDate>
<description><![CDATA[<p><fieldset style="border: 1px dashed black; padding:0px;"><ol style="background-color:#3d3d3d;" start="1"><li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;~ $ x=5<li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;~ $ eval PARAM_$x=33<li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;~ $ echo $PARAM_5<li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;33 </ol></fieldset></p>]]></description>
</item>
<item>
<title>Re: [bash]конкатенация имени переменной</title>
<link>https://rulinux.net/message.php?newsid=5256&amp;page=1#33110</link>
<guid>https://rulinux.net/message.php?newsid=5256&amp;page=1#33110</guid>
<pubDate>Mon, 23 Nov 2009 20:13:03 +0300</pubDate>
<description><![CDATA[<p>Дополнительный вопрос: а как можно установить PARAM_n в зависимости от n? Что-то мне bash ругается на отсутствие команды, которая не команда, а содержимое переменной.</p>]]></description>
</item>
<item>
<title>Re: [bash]конкатенация имени переменной</title>
<link>https://rulinux.net/message.php?newsid=5256&amp;page=1#33109</link>
<guid>https://rulinux.net/message.php?newsid=5256&amp;page=1#33109</guid>
<pubDate>Mon, 23 Nov 2009 19:54:28 +0300</pubDate>
<description><![CDATA[<p>Спасибо, уже и сам нашёл.</p><p>Повторю для себя: </p><p>man bash про eval \$$a или ${!a}</p><p></p>]]></description>
</item>
<item>
<title>Re: [bash]конкатенация имени переменной</title>
<link>https://rulinux.net/message.php?newsid=5256&amp;page=1#33108</link>
<guid>https://rulinux.net/message.php?newsid=5256&amp;page=1#33108</guid>
<pubDate>Mon, 23 Nov 2009 19:40:19 +0300</pubDate>
<description><![CDATA[<p>PARAM_3=&quot;world&quot;</p><p>PARAM_5=&quot;hello&quot;</p><p>some_func() {</p><p>    eval x=&#039;$&#039;PARAM_$1</p><p>    echo $x</p><p>}</p><p>some_func 5</p><p>some_func 3</p>]]></description>
</item>
<item>
<title>[bash]конкатенация имени переменной</title>
<link>https://rulinux.net/message.php?newsid=5256&amp;page=1#33107</link>
<guid>https://rulinux.net/message.php?newsid=5256&amp;page=1#33107</guid>
<pubDate>Mon, 23 Nov 2009 19:22:00 +0300</pubDate>
<description><![CDATA[<p>Хочу вызывать функцию и, в зависимости от её параметров, обращаться к той или иной переменной, например: =code{ some_func 5 -&gt; обращение к переменной PARAM_5 some_func 3 -&gt; обращение к переменной PARAM_3 }</p><p>Как такое сделать в скриптах на sh?</p><p>PS: для Си такое есть в его препроцессоре: <fieldset style="border: 1px dashed black; padding:0px;"><ol style="background-color:#3d3d3d;" start="1"><li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;#define ASD ASD##asd // ASD==ASDasd<li style="background-color:#000000; padding-left: 5px; color: gray">&nbsp;</ol></fieldset></p>]]></description>
</item>
</channel>
</rss>