<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8547795022653480862</id><updated>2012-02-16T05:26:09.622-08:00</updated><title type='text'>Shell Script in a Nutshell</title><subtitle type='html'>Novidades relacionadas ao poderoso shell script e suas peculiaridades.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-3347205505591695766</id><published>2009-02-04T09:10:00.000-08:00</published><updated>2009-02-04T09:11:27.529-08:00</updated><title type='text'>How to check what port a DB2 instance is listening to</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;right now we faced a problem that we didn't know what port a db2 was listening to and to solve the issue we issued the following commands in a Solaris box (should also work in AIX or RedHat):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//check what port DB2 should be using:&lt;br /&gt;$ db2 get dbm cfg | grep SVCENAME&lt;br /&gt;  &lt;br /&gt;//if it's &lt;span style="font-weight:bold;"&gt;not numeric&lt;/span&gt;, check the number in /etc/services:&lt;br /&gt;$ grep db2c_db2svc01 /etc/services&lt;br /&gt;&lt;br /&gt;//and if you want to confirm that DB2 is indeed listening to that port, issue:&lt;br /&gt;$ netstat -a | grep DB2&lt;br /&gt;  &lt;br /&gt;//Or in Windows client, check if you can get a tcp connection&lt;br /&gt;c:\&gt;telnet server_ip server_port&lt;br /&gt;&lt;br /&gt;cheers,&lt;br /&gt;&lt;br /&gt;Borys Marcelo&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-3347205505591695766?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/3347205505591695766/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=3347205505591695766' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3347205505591695766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3347205505591695766'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2009/02/how-to-check-what-port-db2-instance-is.html' title='How to check what port a DB2 instance is listening to'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-2886356735938434606</id><published>2009-02-04T04:22:00.000-08:00</published><updated>2009-02-04T04:28:04.483-08:00</updated><title type='text'>How to retrieve lines before and after in a AIX / Solaris box when -B and -A options are not available</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;when you find yourself trying to retrieve the lines before and after of an occurrence of an exception or keyword in a log file and you discover that in AIX or Solaris box you don't have such a options in grep command, the below command will help you in that issue:&lt;br /&gt;&lt;br /&gt;nawk 'c--&gt;0;$0~s{if(b)for(c=b+1;c&gt;1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=10 a=10 s="NullPointerException" server.log &lt;br /&gt;&lt;br /&gt;where:&lt;br /&gt;&lt;br /&gt;b means Before and is the same as the -B option in gnu grep&lt;br /&gt;a means After and is the same as the -A option in gnu grep&lt;br /&gt;s means the keyword or string you are looking for&lt;br /&gt;&lt;br /&gt;cheers,&lt;br /&gt;&lt;br /&gt;Borys Marcelo&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-2886356735938434606?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/2886356735938434606/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=2886356735938434606' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/2886356735938434606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/2886356735938434606'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2009/02/how-to-retrieve-lines-before-and-after.html' title='How to retrieve lines before and after in a AIX / Solaris box when -B and -A options are not available'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-3001205783442449761</id><published>2008-01-11T12:40:00.000-08:00</published><updated>2008-01-11T12:47:48.402-08:00</updated><title type='text'>Getting rid of ^M character while printing out a report</title><content type='html'>Hi, recently I got in turns with a problem in a CSV report. The report was printed out correctly but because of a ^M a new line had been added and the report was generated with extra lines. A mishmash. But fortunately, I've found a solution:&lt;br /&gt;&lt;br /&gt;In the variable that holds your value to be printed out in a report, say CSV, you need to use awk to remove the ^M (carrot M)&lt;br /&gt;&lt;br /&gt;DETAILS=`echo $DETAILS | awk -v RS="^M" -v ORS="" '{print}'`&lt;br /&gt;&lt;br /&gt;but BE SURE you make &lt;code&gt;^M USING "CTRL-V CTRL-M" NOT BY TYPING "CARROT M"! because if you don't, ^M will not be replaced at all as you are typing it as literal not as a metacharacter.&lt;br /&gt;&lt;br /&gt;* CRTL+V=^&lt;br /&gt;  CRTL+M=M&lt;br /&gt;&lt;br /&gt;^M= carriage return&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the above worked for me, please post here if you have any questions. Thanks.&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-3001205783442449761?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/3001205783442449761/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=3001205783442449761' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3001205783442449761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3001205783442449761'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2008/01/getting-rid-of-m-character-while.html' title='Getting rid of ^M character while printing out a report'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-5982141925915049249</id><published>2008-01-04T13:55:00.000-08:00</published><updated>2008-01-04T13:57:57.741-08:00</updated><title type='text'>Linux is not Windows</title><content type='html'>Here is a good article for new Linux users that explain very well that Linux is not a Windows and what the new user have to expect of it:&lt;br /&gt;&lt;a href="http://linux.oneandoneis2.org/LNW.htm"&gt;&lt;br /&gt;http://linux.oneandoneis2.org/LNW.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-5982141925915049249?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/5982141925915049249/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=5982141925915049249' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5982141925915049249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5982141925915049249'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2008/01/linux-is-not-windows.html' title='Linux is not Windows'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-4072127443801116439</id><published>2008-01-04T06:06:00.000-08:00</published><updated>2008-01-04T06:21:49.402-08:00</updated><title type='text'>How to recover your xorg configuration in Ubuntu / Linux?</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;first of all, it's a good practice to keep a backup of the xorg configuration file right after Ubuntu installation finishes. Because you will already have a running xorg configuration that you will be able to use in case of something getting wrong, say, after a 3D video card installation or something liked. Then, let's walk through the steps:&lt;br /&gt;&lt;br /&gt;1 - If you cannot see anything when GDM starts, you need to start linux in a safe-mode or just issue CRTL+ALT+F1 to see a terminal prompt&lt;br /&gt;2 - Log into you Linux as usual and go to /etc/X11/&lt;br /&gt;3 - issue ls -l xorg*  and you will see xorg configuration files:&lt;br /&gt;$ ls -l xorg*&lt;br /&gt;-rw-r--r-- 1 root root 2390 Nov 23 00:28 xorg.bak_rodando&lt;br /&gt;-rw-r--r-- 1 root root 2516 Nov 19 21:11 xorg.bichado&lt;br /&gt;-rw-r--r-- 1 root root 2390 Jan  4 09:25 xorg.conf&lt;br /&gt;-rw-r--r-- 1 root root 2300 Nov 18 01:16 xorg.conf~&lt;br /&gt;-rw-r--r-- 1 root root 2305 Nov 18 01:33 xorg.conf.backup&lt;br /&gt;-rw-rw-r-- 1 root root 2719 Nov 22 23:55 xorg.conf.backup-ati-fglrx&lt;br /&gt;-rw-r--r-- 1 root root  803 Nov 17 03:58 xorg.conf.original-0&lt;br /&gt;-rw-r--r-- 1 root root  823 Nov 18 01:41 xorg.conf.original-1&lt;br /&gt;&lt;br /&gt;4 - If this is the first time you are restarting your computer, than you can use the xorg.original-0&lt;br /&gt;5 - then as root or with sudo command issue&lt;br /&gt;sudo cp xorg.conf.original-0 xorg.conf&lt;br /&gt;say y[es] if prompt for a confirmation.&lt;br /&gt;6 - Now if you tried everything and yet you are not able to see anything when GDM starts, you will need to generate a brand new xorg conf file. To do so, issue as root or with sudo:&lt;br /&gt;&lt;br /&gt;sudo &lt;code&gt; dpkg-reconfigure xserver-xorg&lt;br /&gt;&lt;br /&gt;follow on screen instructions and you will have your xorg conf to previous state.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;please post a comment whether any question.&lt;br /&gt;&lt;br /&gt;Borys&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-4072127443801116439?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/4072127443801116439/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=4072127443801116439' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/4072127443801116439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/4072127443801116439'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2008/01/how-to-recover-your-xorg-configuration.html' title='How to recover your xorg configuration in Ubuntu / Linux?'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-6606862094700840032</id><published>2007-12-27T04:58:00.000-08:00</published><updated>2007-12-27T05:09:35.256-08:00</updated><title type='text'>How to use IF statement more properly</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;  when I first developed a sh script I ended up with a bunch of If's clauses since the only IF statement I had heard about it was the&lt;br /&gt;if [ ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;this because if you are using IF statement with square brackets, you can only test for a unique assertion. But, what if you need to do a short circuit using || and &amp;amp;&amp;amp;? If you are not able to do that you will probably end with a bunch of ifs to accommodate this deficiency. But there is a solution, you need to use the IF statement with a double parenthesis, like this:&lt;br /&gt; &lt;br /&gt;      * no extra space between (( and $a and between 10 and ))  allowed&lt;br /&gt;if (($a &lt; 0 &amp;amp;&amp;amp; $b &lt; 10))&lt;br /&gt;then&lt;br /&gt;  #statements go here&lt;br /&gt;fi&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-6606862094700840032?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/6606862094700840032/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=6606862094700840032' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6606862094700840032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6606862094700840032'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/12/how-to-use-if-statement-more-properly.html' title='How to use IF statement more properly'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-2582546399633203268</id><published>2007-12-26T08:26:00.000-08:00</published><updated>2007-12-26T08:44:42.086-08:00</updated><title type='text'>How to return the number correspondent to any given Month name</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;today I'm facing a problem: How to return the number corresponding to Jan, Feb, Mar.... in the date String returned by&lt;br /&gt;chage -l &lt;username&gt; ?&lt;br /&gt;&lt;br /&gt;For example, when I issue chage -l myusername it gives me:&lt;br /&gt;&lt;br /&gt;Last password change                                    : Nov 17, 2007&lt;br /&gt;Password expires                                        : Feb 15, 2008&lt;br /&gt;Password inactive                                       : never&lt;br /&gt;Account expires                                         : never&lt;br /&gt;Minimum number of days between password change          : 0&lt;br /&gt;Maximum number of days between password change          : 90&lt;br /&gt;Number of days of warning before password expires       : 7&lt;br /&gt;&lt;br /&gt;So, I made a grep command in union with a gawk command to bring me the 3 last pieces of this lines for any line containing expires in their name. So it gives me&lt;br /&gt;&lt;br /&gt;Feb 15, 2008&lt;br /&gt;never&lt;br /&gt;never&lt;br /&gt;&lt;br /&gt;so, with Feb 15, 2008 in my hands, what I could do with that? Nothing, because I cannot use Feb to compare with another date in order to get number of days for the next user account expiration. Given this scenario, we have to options:&lt;br /&gt;&lt;br /&gt;1 - Create a function with a whole bunch of ifs in order to switch between Name / Number like:&lt;br /&gt;&lt;br /&gt;    if [ $1 == "Jan" ]&lt;br /&gt;   then&lt;br /&gt;      return 1&lt;br /&gt;  and so...&lt;br /&gt;&lt;br /&gt;2 - use the built in Linux date command:&lt;br /&gt;&lt;br /&gt;   /bin/date --d="Feb 15, 2008" +%m&lt;br /&gt;&lt;br /&gt;   the above gives you the number 11 as result. Then you can issue /bin/date +%m and get current month and do the needful to calculate days before account expiration or password expiration.&lt;br /&gt;&lt;br /&gt;Please, post here if you have any questions, thanks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-2582546399633203268?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/2582546399633203268/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=2582546399633203268' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/2582546399633203268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/2582546399633203268'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/12/how-to-return-number-correspondent-to.html' title='How to return the number correspondent to any given Month name'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-9147442244809973637</id><published>2007-12-24T17:17:00.000-08:00</published><updated>2007-12-24T17:29:58.128-08:00</updated><title type='text'>How to increase the screen resolution available on Ubuntu</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;recently I removed my Ubutun installation to  install Mandriva One distro. It was full of bug, so I decided to give a shot to OpenSuse distro. It was terrible as well, nothing worked out-of-the-box and even the sound was not working due to some Alsa packages not being installed. (alsa-firmware, alsa-tools and alsa-utils by the way). So, I decided to go back to Ubuntu  and reinstalled it again. But I forgot to set the screen resolution to 1024 - 768 (the max resolution my laptop can afford) and I ended up with a awful resolution of 800-600. Hopefully, I found a blog with some instructions on how to increase the screen resolution to 1024-768 again and to a bigger resolution if you want. The site is:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.simplehelp.net/2007/04/30/how-to-increase-the-screen-resolutions-available-to-ubuntu-while-running-in-parallels-for-os-x/"&gt;Site&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-9147442244809973637?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/9147442244809973637/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=9147442244809973637' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/9147442244809973637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/9147442244809973637'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/12/how-to-increase-screen-resolution.html' title='How to increase the screen resolution available on Ubuntu'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-6467107359419285916</id><published>2007-12-21T11:07:00.001-08:00</published><updated>2007-12-21T11:27:39.778-08:00</updated><title type='text'>How to evaluate a variable via concatenation or concatenating 2 strings?</title><content type='html'>Sometimes we want to evaluate a value of a variable A where the name of variable A is a concatenation of B + C. I'll give you an example:&lt;br /&gt;&lt;br /&gt;MY_BRANDS=(VOLKS FORD FIAT)&lt;br /&gt;MY_VEHICLES(TRUCK CAR MOTO)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MAX_VALUE_FOR_A_VOLKS_CAR=100&lt;br /&gt;MIN_VALUE_FOR_A_VOLKS_CAR=10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MAX_VALUE_FOR_A_VOLKS_TRUCK=10000&lt;br /&gt;MIN_VALUE_FOR_A_VOLKS_TRUCK=1000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MAX_VALUE_FOR_A_VOLKS_MOTO=10&lt;br /&gt;MIN_VALUE_FOR_A_VOLKS_MOTO=1&lt;br /&gt;&lt;br /&gt;No imagine that you have a function that gives to you the MAX or MIN value for any given BRAND and VEHICLE. Without concatenation you will end up with a plenty of  If elif or switch with a plenty of Cases. But we can do it via concatenation and evaluation:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;#1 first of all create a tmp var&lt;br /&gt;&lt;br /&gt;VAR_TMP_AUX=""&lt;br /&gt;&lt;br /&gt;#now we need to evaluate the concatenation and assign it to VAR_TMP_AUX&lt;br /&gt;&lt;br /&gt;#How to pass parameters&lt;br /&gt;#$1 = MAX or MIN&lt;br /&gt;#$2 = BRAND&lt;br /&gt;#$3 = VEHICLE&lt;br /&gt;giveMeTheMaxOrMinValueForAVehicleOfAnyGivenBrand()&lt;br /&gt;{&lt;br /&gt;PREFIX_VAR_AUX=$1&lt;br /&gt;BRAND_VAR_AUX=$2&lt;br /&gt;VEHICLE_VAR_AUX=$3&lt;br /&gt;&lt;br /&gt;COMMON_PART="_VALUE_FOR_A_"&lt;br /&gt;&lt;br /&gt;eval "VAR_TMP_AUX=\${$PREFIX_VAR_AUX$COMMON_PART$BRAND_VAR_AUX"_"$VEHICLE_VAR_AUX}"&lt;br /&gt;#                                         ^&lt;br /&gt;#                                         |&lt;br /&gt;#                           this is necessary (the \$) because the eval command forces the evaluation of $ not as it was literal but as operator&lt;br /&gt;  return $VAR_TMP_AUX&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;that's it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-6467107359419285916?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/6467107359419285916/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=6467107359419285916' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6467107359419285916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6467107359419285916'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/12/how-to-evaluate-variable-via.html' title='How to evaluate a variable via concatenation or concatenating 2 strings?'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-1071869342145172561</id><published>2007-12-12T08:38:00.000-08:00</published><updated>2007-12-12T08:56:51.257-08:00</updated><title type='text'>Serching patterns and displaying columns using awk</title><content type='html'>Imagine a file products.txt with the following structure:&lt;br /&gt;&lt;br /&gt;ID TYPE                         NAME          WEIGHT COUNTRY DESCRIPTION      PRICE OVERALL&lt;br /&gt;0   SPORT SHOES       SHOES          1                USA             Nike Shoes              100      25&lt;br /&gt;1    SOUVENIR           PENCIL         0.2           BRAZIL      CROWN PENCIL  10        78&lt;br /&gt;2    SOUVENIR           WATCH        0.8           CHINA        Nike Watch             99.99  30          &lt;br /&gt;&lt;br /&gt;then imagine that you need to generate a report based on that file and the report should only display souvenirs and the columns TYPE, NAME COUNTRY and PRICE. What you are going to do? Create a java / dot.net / c++ / c / c# program?  Create a grep command? no... What we need to do here is to use awk to retrieve what columns we really want to:&lt;br /&gt;&lt;br /&gt;cat products.txt | awk '/SOUVENIR/ {$2, $3, $5, $7}'&lt;br /&gt;&lt;br /&gt;here you go! A simple awk program that does much! If you want to know more, please visit the below link for a complete awk tutorial:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.vectorsite.net/tsawk.html"&gt;http://www.vectorsite.net/tsawk.html&lt;/a&gt;&lt;a href="http://www.blogger.com/img/gl.link.gif"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-1071869342145172561?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/1071869342145172561/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=1071869342145172561' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1071869342145172561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1071869342145172561'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/12/serching-patterns-and-displaying.html' title='Serching patterns and displaying columns using awk'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-6444171008882202586</id><published>2007-11-22T11:26:00.000-08:00</published><updated>2007-11-22T11:28:16.905-08:00</updated><title type='text'>Watching streaming videos in Firefox provided via mms protocol</title><content type='html'>For the Linux addicts, I've found a site with some steps to get Firefox properly configured in order to watch streaming videos across web sites that provides videos via mms protocol. To do so follow the steps below:&lt;br /&gt;&lt;br /&gt;As *ROOT*:&lt;br /&gt;&lt;br /&gt;1 - # yum -y install mplayer&lt;br /&gt;2 - # yum -y install mplayerplug-in&lt;br /&gt;3 - # yum -y remove totem-mozplugin&lt;br /&gt;4 - # yum -y install gconf-editor (only if you haven't installed yet)&lt;br /&gt;5 - # gconf-editor &lt;enter&gt;&lt;br /&gt;5.1 - Drill down into: desktop &gt;&gt; gnome &gt;&gt; url-handlers &gt;&gt; mms&lt;br /&gt;5.1.1 - Change the key: totem "%s" to: mplayer "%s"&lt;br /&gt;5.2 - Close the gconf-editor application&lt;br /&gt;6 - Open up the Firefox explorer and in the url put the following:&lt;br /&gt;6.1 - about:config &lt;enter&gt;&lt;br /&gt;6.1.1 - Right click and go to New&gt;&gt;String&lt;br /&gt;Set name as: network.protocol-handler.app.mms&lt;br /&gt;Set value as: /usr/bin/X11/mplayer&lt;br /&gt;&lt;br /&gt;6.1.2 - Right click and go to New&gt;&gt;Boolean&lt;br /&gt;Set name as: network.protocol-handler.external.mms&lt;br /&gt;Set value as: True&lt;br /&gt;7 - Restart Firefox and try to watch videos in your favorite site or you can find an mms video here --&gt; www.globo.com&lt;br /&gt;&lt;br /&gt;8 - If the video load but won't start, follow step 9:&lt;br /&gt;&lt;br /&gt;9 - Right click and got to CONFIGURE&lt;br /&gt;9.1: Set Output Video as: X11&lt;br /&gt;9.2: Set Output Audio as : Alsa&lt;br /&gt;9.3: Set Minimum Cache Size as: Whatever rate you want&lt;br /&gt;9.4: Set Percent of Media to Cache as: Whatever rate you want&lt;br /&gt;9.5: Tick all check-boxes below, right after ” Percent of Media to Cache” with only one exception --&gt; “Play Media directly from site”, which you need to leave unchecked.&lt;br /&gt;10 - Refresh the page and try again.&lt;br /&gt;&lt;br /&gt;The above works for me. I'm using Open Client 2.1 RHE 5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please, let me know if you have questions. Thanks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-6444171008882202586?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/6444171008882202586/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=6444171008882202586' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6444171008882202586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6444171008882202586'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/11/watching-streaming-videos-in-firefox.html' title='Watching streaming videos in Firefox provided via mms protocol'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-5638618368727815102</id><published>2007-11-20T05:53:00.000-08:00</published><updated>2007-11-20T06:16:37.449-08:00</updated><title type='text'>chmod Tutorial</title><content type='html'>Who has ever been stuck giving file access permission before? Well, not anymore! I've just found a link with a useful and easy tutorial about chmod:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://catcode.com/teachmod/index.html"&gt;http://catcode.com/teachmod/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The site even gives you the ability to execute chmod via web!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-5638618368727815102?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/5638618368727815102/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=5638618368727815102' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5638618368727815102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5638618368727815102'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/11/chmod-tutorial.html' title='chmod Tutorial'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-5564644040889107915</id><published>2007-11-08T09:49:00.000-08:00</published><updated>2007-11-08T10:07:43.039-08:00</updated><title type='text'>How to block a port using iptables command line</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;IPTABLES -A INPUT -p tcp --dport 25 -j REJECT&lt;br /&gt;&lt;br /&gt;IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT&lt;br /&gt;&lt;br /&gt;where you see 25, one can change to whatever port we want to keep blocked.&lt;br /&gt;&lt;br /&gt;more information here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://iptables-tutorial.frozentux.net/iptables-tutorial.html#INTRODUCTION"&gt;http://iptables-tutorial.frozentux.net/iptables-tutorial.html#INTRODUCTION&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-5564644040889107915?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/5564644040889107915/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=5564644040889107915' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5564644040889107915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/5564644040889107915'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/11/how-to-block-port-using-iptables.html' title='How to block a port using iptables command line'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-463241752218485959</id><published>2007-10-26T14:41:00.000-07:00</published><updated>2007-10-26T14:42:36.653-07:00</updated><title type='text'>How to use Gzip and Gunzip commands for compressing/uncompressing a file</title><content type='html'>&lt;span class="postbody"&gt;Sometimes we need to uncompress/compress .gz files in AIX and we don't know what command to use or we don't know what options to use. So, here are some examples of how using tar, gzip and gunzip:&lt;br /&gt;&lt;br /&gt;Let's start with gzip:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Usage - It's most used to compress files&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;   &lt;br /&gt;       gzip file.txt  --&gt; compress file.txt, removing the original file and creating file.txt.gz&lt;br /&gt;&lt;br /&gt;gzip -c file.txt &gt; file.txt.gz --&gt; compress file.txt, keeping the original file, redirecting file compression to stdout and the &gt; file.txt.gz redirects the stdout to file.txt.gz, which creates the file&lt;br /&gt;&lt;br /&gt;       gzip -c9 file.txt &gt; file.txt.gz --&gt; same of the above, but option 9 makes a better compression&lt;br /&gt;&lt;br /&gt;       gzip -c1 file.txt &gt; file.txt.gz --&gt; same of the above but option 1 makes a faster compression&lt;br /&gt;&lt;br /&gt;       gzip -cv[91] file.txt &gt; file.txt.gz --&gt; same of the above but option v shows the underlying process verbosity.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GUNZIP:&lt;br /&gt;&lt;br /&gt;       gunzip file.txt.gz --&gt; uncompress file.txt.gz, removing it, and creating the file file.txt&lt;br /&gt;  &lt;br /&gt;gunzip -c file.txt.gz &gt; file.txt --&gt; uncompress file.txt.gz, keeping the original file, redirecting file uncompression to stdout and the &gt; file.txt redirects the stdout to file.txt, which creates the file&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-463241752218485959?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/463241752218485959/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=463241752218485959' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/463241752218485959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/463241752218485959'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/how-to-use-gzip-and-gunzip-commands-for.html' title='How to use Gzip and Gunzip commands for compressing/uncompressing a file'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-303244551001013683</id><published>2007-10-26T14:33:00.000-07:00</published><updated>2007-10-26T14:34:36.685-07:00</updated><title type='text'>How to create a function in a shell script</title><content type='html'>&lt;span class="postbody"&gt;If you want to create a function in your sh script, the first thing you need to do is to declare your function like this:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;    &lt;td&gt;&lt;span class="genmed"&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td class="code"&gt;&lt;br /&gt;&lt;br /&gt;   myFunction()&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;      echo "This is a function"&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class="postbody"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, if you want to call the function you just created, you need to do this:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;    &lt;td&gt;&lt;span class="genmed"&gt;&lt;b&gt;Quote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td class="quote"&gt;&lt;br /&gt;&lt;br /&gt;   myFunction()&lt;br /&gt;   {&lt;br /&gt;  &lt;br /&gt;     echo "This is a function"&lt;br /&gt; &lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   #calling myFunction&lt;br /&gt;    myFunction&lt;br /&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class="postbody"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, if you want to call your function and to receive a parameter send as argument on its body, you need to do this:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;    &lt;td&gt;&lt;span class="genmed"&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;   &lt;td class="code"&gt;&lt;br /&gt;&lt;br /&gt;   #first of all, a parameter get retrieved by using the $ character and the parameter number. i.e. MyVar=$1 for the first parameter, and so.&lt;br /&gt;   myFunction()&lt;br /&gt;   {&lt;br /&gt;  &lt;br /&gt;     echo "This is a function"&lt;br /&gt;     echo "This is the first parameter sent $1--&gt; "$1&lt;br /&gt;     echo "This is the second parameter sent $2--&gt; "$2&lt;br /&gt;     MyVar=$1" &lt;--- value of the first parameter | "$2" Value of the second parameter"&lt;br /&gt;     echo "You get the point! "$MyVar &lt;br /&gt;&lt;br /&gt;   } &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   #calling myFunction, passing 2 parameters as arguments&lt;br /&gt;   param1="This is the first parameter"&lt;br /&gt;   param2="This is the second parameter" &lt;br /&gt;   myFunction "$param1" "$param2"&lt;br /&gt;    &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-303244551001013683?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/303244551001013683/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=303244551001013683' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/303244551001013683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/303244551001013683'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/how-to-create-function-in-shell-script.html' title='How to create a function in a shell script'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-6516689086465566277</id><published>2007-10-25T04:48:00.001-07:00</published><updated>2007-10-25T05:21:09.626-07:00</updated><title type='text'>Get to know Regular Expressions</title><content type='html'>Do you like Regular Expressions? If not, well I think you have never had a chance to know it very well. The following site has all about regular expression. From the beginning to advanced.   It's a very good site to start using regex all over your code!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.regular-expressions.info/"&gt;http://www.regular-expressions.info/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-6516689086465566277?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/6516689086465566277/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=6516689086465566277' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6516689086465566277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6516689086465566277'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/get-to-know-regular-expressions.html' title='Get to know Regular Expressions'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-1989360968952342484</id><published>2007-10-24T14:19:00.001-07:00</published><updated>2007-10-24T14:20:57.930-07:00</updated><title type='text'>Sed Tutorial</title><content type='html'>I found a very useful tutorial where we can learn about sed command and it's good to keep it in your bookmarks : )&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.grymoire.com/Unix/Sed.html"&gt;http://www.grymoire.com/Unix/Sed.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-1989360968952342484?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/1989360968952342484/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=1989360968952342484' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1989360968952342484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1989360968952342484'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/sed-tutorial.html' title='Sed Tutorial'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-6776571524417861273</id><published>2007-10-24T13:59:00.000-07:00</published><updated>2007-10-25T04:38:03.053-07:00</updated><title type='text'>String replacement</title><content type='html'>Here is what you need to know about string replacement:&lt;br /&gt;&lt;br /&gt;if you want to replace a character from a string, just do this:&lt;br /&gt;&lt;br /&gt;MY_STR="12345"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MY_STR=${MY_STR//[1-3]*/' '}&lt;br /&gt;&lt;br /&gt;echo $MY_STR    # result --&gt;  45&lt;br /&gt;&lt;br /&gt;So, for replacing a key in a string, you need to use the ${string//replace_this/for_this}&lt;br /&gt;replace_this could be a regex like our first example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is an url that a whole bunch of REGEX that you can put in your replace_this regex, have fun:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.baremetalsoft.com/baregrep/regex.php"&gt;http://www.baremetalsoft.com/baregrep/regex.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-6776571524417861273?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/6776571524417861273/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=6776571524417861273' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6776571524417861273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/6776571524417861273'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/string-replacement.html' title='String replacement'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-3097956766549696447</id><published>2007-10-24T12:09:00.000-07:00</published><updated>2007-10-24T12:14:51.076-07:00</updated><title type='text'>Sending emails in an AIX, UNIX, Linux command line</title><content type='html'>Below are two examples of how we can send an email using shell command in a Unix like OS:&lt;br /&gt;&lt;br /&gt;Example 1 - Sending a simple note:&lt;br /&gt;&lt;br /&gt;mail -s "Here goes the subject" email_to_1@your_company.com, email_to_2@your_company.com &lt; your_email_body_text_stored_in_a_tmp_file.txt&lt;br /&gt;&lt;br /&gt;options:&lt;br /&gt;&lt;br /&gt;-c send_copy_to_first_email@your_company.com, send_copy_to_second_email@your_company.com, and so&lt;br /&gt;&lt;br /&gt;-b send_blind_carbon_copy_to_first_email@your_company.com, and so&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example 2 Sending attachments:&lt;br /&gt;&lt;br /&gt;mutt -s "Here goes the subject" -a my_attachment.any_extension   email_to_1@your_company.com, email_to_2@your_company.com &lt; your_email_body_text_stored_in_a_tmp_file.txt&lt;br /&gt;&lt;br /&gt;or, you can use the command: nail  with the same options as in mutt.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please, let me know if you have questions&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-3097956766549696447?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/3097956766549696447/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=3097956766549696447' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3097956766549696447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/3097956766549696447'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/sending-emails-in-aix-unix-linux.html' title='Sending emails in an AIX, UNIX, Linux command line'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-179969421713719583</id><published>2007-10-24T11:28:00.000-07:00</published><updated>2007-10-25T09:44:17.009-07:00</updated><title type='text'>How to retrieve /  return the whole  / full line of a grep result set using for ... in</title><content type='html'>I don't know if you guys have already faced an issue like this... But, recently I had to write a shell script where I had to iterate through a result set retrieved from a grep command, and while it was iterating through out the keys, I noticed that the collection of keys returned by grep had been split up by blank spaces and it wasn't what I was looking for. I wanted to retrieve each line by iteration. So, as I was not familiar with AWK, I decided to implement a function for doing the hard work.&lt;br /&gt;&lt;br /&gt;Basically,  the function receives two parameters: the 1st is the Key and 2nd is the delimiter.&lt;br /&gt;&lt;br /&gt;Here is the function and how to call it inside a sh script. Enjoy it!&lt;br /&gt;&lt;br /&gt;#External Vars&lt;br /&gt;P_VEZ_AUX=0&lt;br /&gt;STR_READY_TO_USE=""&lt;br /&gt;MAIN_KEY_AUX=""&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;getTheWholeLineInAGrepCollection()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;KEY_AUX_2="$1"&lt;br /&gt;KEY_DELIMITER=$2&lt;br /&gt;&lt;br /&gt;if [ "$KEY_AUX_2" == $KEY_DELIMITER ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;  if [ "$P_VEZ_AUX" -eq 0 ]&lt;br /&gt;  then&lt;br /&gt;     let P_VEZ_AUX=1&lt;br /&gt;  MAIN_KEY_AUX=$MAIN_KEY_AUX$KEY_AUX_2&lt;br /&gt;  return 0&lt;br /&gt;  else&lt;br /&gt;&lt;br /&gt;   STR_READY_TO_USE=$MAIN_KEY_AUX&lt;br /&gt;   MAIN_KEY_AUX=$KEY_AUX_2&lt;br /&gt;   return 1&lt;br /&gt;  fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt; MAIN_KEY_AUX=$MAIN_KEY_AUX" "$KEY_AUX_2&lt;br /&gt;&lt;br /&gt; return 0&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#Then, to calling the function&lt;br /&gt;&lt;br /&gt;# -A 1 --&gt; extended results 1 line After matched result&lt;br /&gt;# -0 --&gt;  returns only what is inside the regex&lt;br /&gt;&lt;br /&gt;KEYS=`egrep -A 1 "NullPointerException" SystemOut.log | egrep -o "at"\ [A-Za-z.-_\(]`&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#but... before we begin, as the number of words may vary, we most first test the number of #matching against our delimiter, which in this case is 'at'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TAM_KEYS=`echo "$KEYS"  | grep -c 'at'`&lt;br /&gt;&lt;br /&gt;#now we most check if TAM_KEYS is zero&lt;br /&gt;&lt;br /&gt;if [ "$TAM_KEYS" -eq 0 ]&lt;br /&gt;then&lt;br /&gt; echo "No matching records"&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#now, if our string begins with the delimiter, you probably will face problems in case a grep statement returning only a single line&lt;br /&gt;#To avoid that kind of error, we most concatenate our delimiter at the end of our KEYS collection of words in order to have our  STR_READY_TO_USE properly set and to have a return of 1&lt;br /&gt;#or we can simply not enter in the for loop as we already have the whole line in the KEYS var&lt;br /&gt;&lt;br /&gt;if [ "$TAM_KEYS" -eq 1 ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;  #adding the delimiter as the end of our KEYS collection as we have a single line and as our&lt;br /&gt; #delimiter comes at the front of each line&lt;br /&gt;   KEYS=$KEYS" at"  #don't forget about the extra space at the front of delimiter&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for KEY in KEYS&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt; #In case a line being:&lt;br /&gt; #at br.com.minhaempresa.actions.MinhaAction&lt;br /&gt; # thus, keys will be sent 3 times  and each iteration will occurs three times as well:&lt;br /&gt; #"at", " ", "br.com.minhaempresa.actions.MinhaAction"&lt;br /&gt;&lt;br /&gt; #However, if we want the whole line, isolated keys won't help at all.&lt;br /&gt;#Finally, we use then our super function for doing the hard work:&lt;br /&gt;#$KEY is the key returned on each iteration and "at" is our delimiter:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;getTheWholeLineInAGrepCollection $KEY "at"&lt;br /&gt;&lt;br /&gt;#retrieving return value&lt;br /&gt;&lt;br /&gt;RET=$?&lt;br /&gt;&lt;br /&gt;# and the we need to verify if RET equals 1, which indicates our String is ready to use&lt;br /&gt;&lt;br /&gt;if [ "$RET" -eq 1 ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# var --&gt; STR_READY_TO_USE , is being set by our function after completing String concatenation&lt;br /&gt;&lt;br /&gt;  echo "full line by a given delimiter ---&gt; " $STR_READY_TO_USE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;fi  #end of if for TAM_KEYS == 0&lt;br /&gt;&lt;br /&gt;key-words, tags tag : shell script bash sh for while grep egrep AIX Linux Unix loop iteration variable var&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please, let me know if you have questions!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-179969421713719583?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/179969421713719583/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=179969421713719583' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/179969421713719583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/179969421713719583'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/retrieving-whole-line-of-grep-result.html' title='How to retrieve /  return the whole  / full line of a grep result set using for ... in'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8547795022653480862.post-1559808364780750683</id><published>2007-10-24T09:46:00.000-07:00</published><updated>2007-10-25T09:30:13.817-07:00</updated><title type='text'>Retornando uma linha por vez ao receber um resultado do grep, utilizando for ... in</title><content type='html'>Eu não sei se alguém já passou por esse tipo de probleminha... Mas recentemente tive que escrever um shell script onde o resultado de um grep era recebido em uma variável e atráves do FOR eu varria os resultados retornados pelo grep command. Só que o problema era que os resultados eram retornados separados por " " spaços. E a cada iteração do for, uma única palavra era retornado, o que impossibilitava que eu pegasse essa palavra e utilizaçe como key para outro grep.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Como não tinha conhecimento de AWK, que depois fiquei sabendo que faz exatamente o que eu queria, acabei fazendo uma função no próprio shell script que busca por um delimitador da coloção de resultados que o grep retorna e te avisa quando a linha que vc quer, dado o delimitador, estiver pronta. Eis o código: (espero que ajude alguém com o mesmo problema!)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#Variáveis externas&lt;br /&gt;P_VEZ_AUX=0&lt;br /&gt;STR_READY_TO_USE=""&lt;br /&gt;MAIN_KEY_AUX=""&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;getLinhaCompletaDeUmGrep()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; KEY_AUX_2="$1"&lt;br /&gt; KEY_DELIMETER=$2&lt;br /&gt;&lt;br /&gt; if [ "$KEY_AUX_2" == $KEY_DELIMETER ]&lt;br /&gt; then&lt;br /&gt;&lt;br /&gt;     if [ "$P_VEZ_AUX" -eq 0 ]&lt;br /&gt;     then&lt;br /&gt;        let P_VEZ_AUX=1&lt;br /&gt;     MAIN_KEY_AUX=$MAIN_KEY_AUX$KEY_AUX_2&lt;br /&gt;     return 0&lt;br /&gt;     else&lt;br /&gt;   &lt;br /&gt;      STR_READY_TO_USE=$MAIN_KEY_AUX&lt;br /&gt;      MAIN_KEY_AUX=$KEY_AUX_2&lt;br /&gt;      return 1&lt;br /&gt;     fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  else&lt;br /&gt;&lt;br /&gt;    MAIN_KEY_AUX=$MAIN_KEY_AUX" "$KEY_AUX_2&lt;br /&gt;&lt;br /&gt;    return 0&lt;br /&gt;&lt;br /&gt; fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#daí para chamar a função&lt;br /&gt;&lt;br /&gt;# -A 1 --&gt; resultado estendido a 1 linha After (após) o resultado encontrado&lt;br /&gt;# -0 --&gt; traz only (somente) o que estiver especificado no regex&lt;br /&gt;&lt;br /&gt;KEYS=`egrep -A 1 "NullPointerException" SystemOut.log | egrep -o "at"\ [A-Za-z.-_\(]`&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#mas... antes de mais nada, como a quantidade de palavras na coleção é variável,&lt;br /&gt;#devemos primeiro testar a quantidade de matches para o delimitador primeiro, no nosso caso é o 'at'.&lt;br /&gt;&lt;br /&gt;TAM_KEYS=`echo "$KEYS"  | grep -c 'at'`&lt;br /&gt;&lt;br /&gt;#agora checamos se o TAM_KEYS é 0 (zero)&lt;br /&gt;&lt;br /&gt;if [ "$TAM_KEYS" -eq 0 ]&lt;br /&gt;then&lt;br /&gt; echo "Nenhum match encontrado"&lt;br /&gt;else&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#agora se o seu delimitador fica no começo como o do exemplo&lt;br /&gt;#você enfrentará problemas caso existam somente uma linha retornada pelo grep.&lt;br /&gt;#Para isso devemos concatenar o nosso delimitador no final da coleção keys&lt;br /&gt;#assim a nossa função vai setar a variável STR_READY_TO_USE e retornar 1&lt;br /&gt;#ou simplemente nao entre no for e já utilize o KEYS como sua linha, o que realmente ela é&lt;br /&gt;&lt;br /&gt;if [ "$TAM_KEYS" -eq 1 ]&lt;br /&gt;then&lt;br /&gt;&lt;br /&gt;  #adicionando o delimitador no final quando nosso delimitador vir no começo&lt;br /&gt;  # e quando só existirem uma ocorrência do delimitador na coleção retornada pelo grep&lt;br /&gt;  KEYS=$KEYS" at" #nao se esqueça do espaço antes do delimitador&lt;br /&gt;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for KEY in KEYS&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;    #caso a linha seja:&lt;br /&gt;    #at br.com.minhaempresa.actions.MinhaAction&lt;br /&gt;    # então o key vai ser enviado três vezes, e a iteração ocorrerá três vezes também:&lt;br /&gt;    #"at", " ", "br.com.minhaempresa.actions.MinhaAction"&lt;br /&gt; &lt;br /&gt;    #Porém, como queremos a linha completa, esses resultados isolados não nos importa, mas sim a linha completa.&lt;br /&gt;&lt;br /&gt;    #utilizamos então nossa função para isso:  $KEY é o resultado iterado e o "at" é o delimitador que queremos&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   getLinhaCompletaDeUmGrep $KEY "at"&lt;br /&gt; &lt;br /&gt;   #pegamos o retorno&lt;br /&gt;&lt;br /&gt;   RET=$?&lt;br /&gt;&lt;br /&gt;  # e verificamos se o retorno é 1, o que indica que nossa String está pronta para ser usada&lt;br /&gt;&lt;br /&gt;  if [ "$RET" -eq 1 ]&lt;br /&gt;  then&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# a vraiável --&gt; STR_READY_TO_USE , está sendo setada pela nossa função após completar a concatenação&lt;br /&gt;&lt;br /&gt;     echo "Temos uma linha completa concatenada da coleção do grep, dado um delimitador ---&gt; " $STR_READY_TO_USE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   fi&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;fi #if do TAM_KEYS -eq 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;qualquer dúvida, manda um post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8547795022653480862-1559808364780750683?l=shellscriptclub.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shellscriptclub.blogspot.com/feeds/1559808364780750683/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8547795022653480862&amp;postID=1559808364780750683' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1559808364780750683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8547795022653480862/posts/default/1559808364780750683'/><link rel='alternate' type='text/html' href='http://shellscriptclub.blogspot.com/2007/10/retornando-uma-linha-por-vez-ao-receber.html' title='Retornando uma linha por vez ao receber um resultado do grep, utilizando for ... in'/><author><name>Borys Marcelo</name><uri>http://www.blogger.com/profile/12438500189694284933</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_DBLfR599brs/SxKBiYAsaEI/AAAAAAAAAD8/7n0kp3cVkNA/S220/avatar_borys_social_2.png'/></author><thr:total>0</thr:total></entry></feed>
