<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: BASH Shell Frequently Asked Questions</title> <atom:link href="http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Zhiyi</title><link>http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html#comment-143479</link> <dc:creator>Zhiyi</dc:creator> <pubDate>Wed, 16 Apr 2008 21:48:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html#comment-143479</guid> <description>See my solution
&lt;code&gt;
#!/bin/bash
#one approach is to use array
dir=(/home/abc/xyz1 /home/abc/xyz2 /home/cft/dsf)
x=0
while [ $x -lt ${#dir[@]} ];
do
echo ${dir[x]}
((x++))
done
# another one is just use &#039;for&#039;
echo &quot;&quot;
dirs=&quot;/home/abc/xyz1 /home/abc/xyz2 /home/cft/dsf&quot;
for dir in $dirs
do
echo $dir
done
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>See my solution<br
/> <code><br
/> #!/bin/bash</p><p>#one approach is to use array<br
/> dir=(/home/abc/xyz1 /home/abc/xyz2 /home/cft/dsf)<br
/> x=0<br
/> while [ $x -lt ${#dir[@]} ];<br
/> do<br
/> echo ${dir[x]}<br
/> ((x++))<br
/> done</p><p># another one is just use 'for'<br
/> echo ""<br
/> dirs="/home/abc/xyz1 /home/abc/xyz2 /home/cft/dsf"<br
/> for dir in $dirs<br
/> do<br
/> echo $dir<br
/> done<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Manojg</title><link>http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html#comment-143254</link> <dc:creator>Manojg</dc:creator> <pubDate>Sun, 23 Mar 2008 16:04:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/bash-shell-frequently-asked-questions.html#comment-143254</guid> <description>Hi,
I am using bash shell. I have a list of selected directories and want to loop over these directories. The code is like this:
=========================================
#!/bin/bash
dir1=/home/abc/xyz1
dir2=/home/abc/xyz2
dir3=/home/cft/dsf
------------
------------
x=1
dir=&quot;&quot;
while [ $x -le 8 ]; do
echo $(&quot;dir&quot;$x)
let x++
done
===========================================
In output it produces dir1, dir2, dir3 etc., not the full name directory as defined above. How should I do this?
Thanks
Manojg</description> <content:encoded><![CDATA[<p>Hi,</p><p>I am using bash shell. I have a list of selected directories and want to loop over these directories. The code is like this:</p><p>=========================================<br
/> #!/bin/bash<br
/> dir1=/home/abc/xyz1<br
/> dir2=/home/abc/xyz2<br
/> dir3=/home/cft/dsf<br
/> &#8212;&#8212;&#8212;&#8212;<br
/> &#8212;&#8212;&#8212;&#8212;</p><p>x=1<br
/> dir=&#8221;"<br
/> while [ $x -le 8 ]; do<br
/> echo $(&#8220;dir&#8221;$x)<br
/> let x++<br
/> done<br
/> ===========================================</p><p>In output it produces dir1, dir2, dir3 etc., not the full name directory as defined above. How should I do this?</p><p>Thanks<br
/> Manojg</p> ]]></content:encoded> </item> </channel> </rss>
