<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/xsl" href="http://www.daniweb.com/js/rss.xsl"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community
			 - Shell Scripting					</title>
		<link>http://www.daniweb.com/software-development/shell-scripting/113</link>
		<description>Our Shell Scripting forum is the place for Q&amp;A-style discussions related to *nix shell scripting languages such as bash. Note that we also have a separate Perl forum within the Software Development category.</description>
		<language>en-US</language>
		<ttl>60</ttl>
		<!-- PubSubHubbub Discovery -->
		<link rel="hub" href="http://daniweb.superfeedr.com/" xmlns="http://www.w3.org/2005/Atom" />
		<link rel="self" href="http://www.daniweb.com/rss/pull/113" xmlns="http://www.w3.org/2005/Atom" />
		<!-- End Of PubSubHubbub Discovery -->
				<item>
			<title>adding date elements to file name in zip command</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/454901/adding-date-elements-to-file-name-in-zip-command</link>
			<pubDate>Sun, 19 May 2013 05:37:48 +0000</pubDate>
			<description>occasionally I run a backup of my phpbb forum files from the Shell command line: zip -r forum_backup ~/public_html/forum/* I'd like to add date elements to the file name, so that the zip file created is automatically formed as forum_backup_05182013.zip or something similar Thanks</description>
			<content:encoded><![CDATA[ <p>occasionally I run a backup of my phpbb forum files from the Shell command line:</p>

<pre><code class="language-sh">zip -r forum_backup  ~/public_html/forum/*
</code></pre>

<p>I'd like to add date elements to the file name, so that the zip file created is automatically formed as</p>

<pre><code class="language-sh">    forum_backup_05182013.zip
</code></pre>

<p>or something similar</p>

<p>Thanks</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>techman41973</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/454901/adding-date-elements-to-file-name-in-zip-command</guid>
		</item>
				<item>
			<title>Using Grep command - output results to a text file?</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/454897/using-grep-command-output-results-to-a-text-file</link>
			<pubDate>Sun, 19 May 2013 04:19:04 +0000</pubDate>
			<description>When using the Grep command to find a search string in a set of files, is there a way to dump the results to a text file? Also is there a switch for the Grep command that provides cleaner results for better readability, such as a line feed between each ...</description>
			<content:encoded><![CDATA[ <p>When using the Grep command to find a search string in a set of files, is there a way to dump the results<br />
  to a text file?<br />
 Also is there a switch for the Grep command that provides cleaner results for better readability,<br />
such as a line feed between each entry?<br />
Perhaps there is a Grep script that outputs cleaner results</p>

<p>Thanks</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>techman41973</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/454897/using-grep-command-output-results-to-a-text-file</guid>
		</item>
				<item>
			<title>awk sort data bourne shell</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/454720/awk-sort-data-bourne-shell</link>
			<pubDate>Thu, 16 May 2013 07:30:31 +0000</pubDate>
			<description>i have an awk script and in the end section i create my table data with printf and i want to sort it so i used pipe then sort i am calling it like this awk -f awkscript file in bash i can get it to work the way i ...</description>
			<content:encoded><![CDATA[ <p>i have an awk script and in the end section i create my table data with printf and i want to sort it so i used pipe then sort</p>

<p>i am calling it like this awk -f awkscript file</p>

<p>in bash i can get it to work the way i want using</p>

<pre><code class="language-sh">END{




for...



printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t $'\t' -k3,3rn -k2,2rn"
</code></pre>

<p>but this does not work bourne shell on solaris.</p>

<p>as an experiment i did this</p>

<pre><code class="language-sh"> printf "%d\t%d\t%d\n",x, a[x],b[x] &gt; "testfile"
</code></pre>

<p>then on the shell i did this</p>

<pre><code class="language-sh">cat testfile | sort -t "`printf '\t'`" -k3,3nr -k2,2rn
</code></pre>

<p>and this works fine.</p>

<p>My issue is not sure how to insert that back into my awk script as i get confused with all the ""'` etc</p>

<pre><code class="language-sh">printf "%d\t%d\t%d\n",x, a[x],b[x] | "sort -t "`printf '\t'`" -k3,3nr -k2,2rn"
</code></pre>

<p>is error</p>

<p>ive tried different things but cant figure it out</p>

<p>cheers</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>mossman mudas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/454720/awk-sort-data-bourne-shell</guid>
		</item>
				<item>
			<title>Basic for-loops -fixed</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454705/basic-for-loops-fixed</link>
			<pubDate>Wed, 15 May 2013 23:33:59 +0000</pubDate>
			<description>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. ...</description>
			<content:encoded><![CDATA[ <p>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.</p>

<p>Edit: Fixed per Watael's suggestions.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454705/basic-for-loops-fixed</guid>
		</item>
				<item>
			<title>Basic for-loops with strings, arrays, file names, and arguments.</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454702/basic-for-loops-with-strings-arrays-file-names-and-arguments</link>
			<pubDate>Wed, 15 May 2013 22:36:22 +0000</pubDate>
			<description>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. ...</description>
			<content:encoded><![CDATA[ <p>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454702/basic-for-loops-with-strings-arrays-file-names-and-arguments</guid>
		</item>
				<item>
			<title>Show color code chart in your terminal</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454700/show-color-code-chart-in-your-terminal</link>
			<pubDate>Wed, 15 May 2013 22:18:17 +0000</pubDate>
			<description>This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to ...</description>
			<content:encoded><![CDATA[ <p>This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to grab color codes).</p>

<p>I figure someone may get some use out of this, and there aren't many "Shell Scripting" code-snippets, so I'll put it here.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454700/show-color-code-chart-in-your-terminal</guid>
		</item>
				<item>
			<title>The Matrix in your terminal</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454699/the-matrix-in-your-terminal</link>
			<pubDate>Wed, 15 May 2013 22:09:21 +0000</pubDate>
			<description>I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors. This is an example of what you can do with ...</description>
			<content:encoded><![CDATA[ <p>I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors.</p>

<p>This is an example of what you can do with BASH, or possibly other shells, and it's just a neat thing to see. So I offer this up for your amusement, I've tested it and combed through it to make sure there's no hidden tricks. As far as I can tell it only uses a few commands like <code>echo</code>, <code>printf</code>, <code>sleep</code>, and <code>eval</code>, with <code>if</code> statements and color codes.</p>

<p><strong>The Matrix</strong> (<em>matrix.sh</em>):</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454699/the-matrix-in-your-terminal</guid>
		</item>
				<item>
			<title>basic shell</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/454517/basic-shell</link>
			<pubDate>Mon, 13 May 2013 14:06:59 +0000</pubDate>
			<description>hi,a question .. why does my script work as sh script.sh and not as ./script.sh ?? also,i was trying to write a script that would filter out a pattern in a .txt file and display the count of the same. Say my pattern is king, and there are 4 &quot;king&quot;s ...</description>
			<content:encoded><![CDATA[ <p>hi,a question .. why does my script work as sh script.sh and not as ./script.sh ??</p>

<p>also,i was trying to write a script that would filter out a pattern in a .txt file and display the count of the same. Say my pattern is king, and there are 4 "king"s in the txt file .. also there are two "taking"s .. shouldnt the count be 6? m getting 4.<br />
command --  grep -i "king" | wc -l</p>

<p>looking for healthy replies ..</p>

<p>~cheers</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>leghorn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/454517/basic-shell</guid>
		</item>
				<item>
			<title>Problem using gcc in Cygwin</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/454440/problem-using-gcc-in-cygwin</link>
			<pubDate>Sun, 12 May 2013 09:39:12 +0000</pubDate>
			<description>Hello everyone. I am trying to compile this simple code using gcc under Cygwin terminal. //A function that just returns a value// int my_function() { return 0xbaba; } I saved the code as basic.c I issue the command $gcc basic.c in the Cygwin terminal And I get the error: gcc: ...</description>
			<content:encoded><![CDATA[ <p>Hello everyone. I am trying to compile this simple code using gcc under Cygwin terminal.</p>

<pre><code class="language-sh">//A function that just returns a value//
int my_function()
{
    return 0xbaba;
}
</code></pre>

<p>I saved the code as basic.c<br />
I issue the command<br />
$gcc basic.c<br />
in the Cygwin terminal</p>

<p>And I get the error:<br />
gcc: error: spawn: No such file or directory</p>

<p>I already had enough trouble installing GCC under Cygwin. Cant figure out what this means. Please Help!<br />
Thanks in Advance!</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>m_ishwar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/454440/problem-using-gcc-in-cygwin</guid>
		</item>
				<item>
			<title>if operators</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453981/if-operators</link>
			<pubDate>Mon, 06 May 2013 06:18:31 +0000</pubDate>
			<description>hi New to shell scripting. While trying hands at it I came across the operators -z -o in the if block. Any relevant info would be appreciated **if [ -z &quot;$xa_&quot; -o &quot;$va_&quot; == &quot;yes&quot; ]** cheers guys</description>
			<content:encoded><![CDATA[ <p>hi</p>

<p>New to shell scripting. While trying hands at it I came across the operators -z -o in the if block.<br />
Any relevant info would be appreciated</p>

<p><strong>if [ -z "$xa_" -o "$va_" == "yes" ]</strong></p>

<p>cheers guys</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>leghorn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453981/if-operators</guid>
		</item>
				<item>
			<title>UnExpected file names</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453907/unexpected-file-names</link>
			<pubDate>Sat, 04 May 2013 14:33:07 +0000</pubDate>
			<description>I dont know what caused such a filenames and i am not able to remove these files. $ ls A????cd new????cat&gt; &gt;&gt; A A????cd new????cat ????A Desktop Downloads file.sh menu.sh new new1.sh new.sh Pictures rename Videos A????cd new????cat |A A?echo A Documents even.sh filetest.sh Music new1.lst new.lst palindrome.sh Public Templates ...</description>
			<content:encoded><![CDATA[ <p>I dont know what caused such a filenames and i am not able to remove these files.</p>

<pre><code class="language-sh"> $ ls
A????cd new????cat&gt;  &gt;&gt; A  A????cd new????cat ????A  Desktop    Downloads  file.sh      menu.sh  new       new1.sh  new.sh         Pictures  rename     Videos
A????cd new????cat |A      A?echo A                  Documents  even.sh    filetest.sh  Music    new1.lst  new.lst  palindrome.sh  Public    Templates  vowel.sh
</code></pre>

<p>Please Suggest</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>Rahul47</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453907/unexpected-file-names</guid>
		</item>
				<item>
			<title>Using vi commands in Shell Script</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453869/using-vi-commands-in-shell-script</link>
			<pubDate>Fri, 03 May 2013 20:46:42 +0000</pubDate>
			<description>vi is basically used independently .....but what if vi commands are used in shell script ? I am trying to accomplish functionality of mv command using a shell script. what I want is to yank whole text of one file1 and paste it in file2. this all should happen in ...</description>
			<content:encoded><![CDATA[ <p>vi is basically used independently .....but what if vi commands are used in shell script ?<br />
I am trying to accomplish functionality of mv command using a shell script.</p>

<p>what I want is to yank whole text of one file1 and paste it in file2.<br />
this all should happen in Shell Script.</p>

<p>So far I have dont following script.</p>

<pre><code class="language-sh">#!/bin/bash
#file.sh

echo -e "\n\t|------------------ File Transfer -----------------------|"

while [ "$ch" != "n" ]
do
        echo -e "\nEnter directory"
        read dir

        echo -e "\nEnter filename"
        read flnam

        if [ -d $dir ]
        then
                if [ -e $flnm ]
                then
                        vi $flnm `| "+y | esc | :x`     # ERROR
                        cd $dir                         
                        vi $flnm `| p | esc | :x`       # ERROR

                fi
        else
                echo "Directory does not exists."
        fi

        echo "Do you want to try again? (y/n)"
        read ch
done
</code></pre>

<p>vi commands are not working in shell script.....I know am missing right format of its use.<br />
Any Suggestions ?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>Rahul47</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453869/using-vi-commands-in-shell-script</guid>
		</item>
				<item>
			<title>run script from anywhere</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453420/run-script-from-anywhere</link>
			<pubDate>Sat, 27 Apr 2013 03:01:07 +0000</pubDate>
			<description>Hi Any one can guide me to the right direction. I trying to run my scripts from anywhere, how about to do it: I did this but is not working. export PATH = $PATH:/scripts/pyhon But is not working Thank you</description>
			<content:encoded><![CDATA[ <p>Hi Any one can guide me to the right direction.<br />
I trying to run my scripts from anywhere, how about to do it:<br />
I did this but is not working.</p>

<pre><code class="language-sh">export PATH = $PATH:/scripts/pyhon
</code></pre>

<p>But is not working<br />
Thank you</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>toldav</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453420/run-script-from-anywhere</guid>
		</item>
				<item>
			<title>Java won&#039;t run cmd using runtime() ?</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453346/java-wont-run-cmd-using-runtime-</link>
			<pubDate>Fri, 26 Apr 2013 01:45:50 +0000</pubDate>
			<description>Hi guys I try to run this shell in java but it never works. Process p = Runtime.getRuntime().exec(&quot; cat *.java|sed '/import/d'|sed'/package/d'&gt;&gt;b.java &quot;); when I change the cmd to something like &quot;ls&quot; or &quot;open foo.java&quot; the code will works. Any idea why?</description>
			<content:encoded><![CDATA[ <p>Hi guys<br />
I try to run this shell in  java but it never works.</p>

<pre><code class="language-sh">    Process p = Runtime.getRuntime().exec(" cat *.java|sed '/import/d'|sed'/package/d'&gt;&gt;b.java ");
</code></pre>

<p>when I change the cmd to something like "ls" or "open foo.java" the code will works.</p>

<p>Any idea why?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>yue.sun.35</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453346/java-wont-run-cmd-using-runtime-</guid>
		</item>
				<item>
			<title>is it possible to compare two files created on different platforms?</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453071/is-it-possible-to-compare-two-files-created-on-different-platforms</link>
			<pubDate>Tue, 23 Apr 2013 03:53:41 +0000</pubDate>
			<description>i have 2 files, one file created on Windows and another was made on Ubuntu, i want to use this command: comm -12 file1 file2 how do i do that?</description>
			<content:encoded><![CDATA[ <p>i have 2 files,</p>

<p>one file created on Windows and another was made on Ubuntu,</p>

<p>i want to use this command:</p>

<pre><code class="language-sh">comm -12 file1 file2
</code></pre>

<p>how do i do that?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>1a2p3a4c5h6e</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453071/is-it-possible-to-compare-two-files-created-on-different-platforms</guid>
		</item>
				<item>
			<title>how do i get decimal from a string</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/453033/how-do-i-get-decimal-from-a-string</link>
			<pubDate>Mon, 22 Apr 2013 14:19:53 +0000</pubDate>
			<description>i got a string var=96.33% from 120 how do i get 96.33 from $var?</description>
			<content:encoded><![CDATA[ <p>i got a string</p>

<p>var=96.33% from 120</p>

<p>how do i get 96.33 from $var?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>1a2p3a4c5h6e</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/453033/how-do-i-get-decimal-from-a-string</guid>
		</item>
				<item>
			<title>calculate disc space used by files owned</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/452921/calculate-disc-space-used-by-files-owned</link>
			<pubDate>Sat, 20 Apr 2013 15:55:34 +0000</pubDate>
			<description>i want to find the total space used for the files owned by me from my current directory. i have du -sh `find ./ -user $USER -type f` which gives 8.0K ./.a 8.0K ./t 4.0K ./cat/A 4.0K ./a using -s has no effect. using du -sh by itself includes the ...</description>
			<content:encoded><![CDATA[ <p>i want to find the total space used for the files owned by me from my current directory.</p>

<p>i have</p>

<pre><code class="language-sh">du -sh `find ./ -user $USER -type f`
</code></pre>

<p>which gives</p>

<pre><code class="language-sh">8.0K    ./.a
8.0K    ./t
4.0K    ./cat/A
4.0K    ./a
</code></pre>

<p>using -s has no effect.</p>

<p>using du -sh by itself includes the space for files not owned by me and also includes space used by folders themselves.</p>

<p>I want to be able to add all of the above and displayed in readable format automatically.</p>

<p>At this stage i am happy to include the space used for folders or not, doesnt matter.</p>

<p>Any tips would be appreciated.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>mossman mudas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/452921/calculate-disc-space-used-by-files-owned</guid>
		</item>
				<item>
			<title>need help with smtp client</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/452871/need-help-with-smtp-client</link>
			<pubDate>Sat, 20 Apr 2013 00:35:07 +0000</pubDate>
			<description>trying to send email from nc nc smtp.gmail.com 587 HELO there 250 mx.google.com at your service STARTTLS 220 2.0.0 Ready to start TLS MAIL FROM:&lt;junk@example.com&gt; connection dies.. whats wrong with the protocol im using??</description>
			<content:encoded><![CDATA[ <p>trying to send email from nc</p>

<p>nc smtp.gmail.com 587<br />
HELO there<br />
250 mx.google.com at your service<br />
STARTTLS<br />
220 2.0.0 Ready to start TLS<br />
MAIL FROM:&lt;junk@example.com&gt;</p>

<p>connection dies..</p>

<p>whats wrong with the protocol im using??</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>coding101</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/452871/need-help-with-smtp-client</guid>
		</item>
				<item>
			<title>creating script and taking average from calling function</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/452678/creating-script-and-taking-average-from-calling-function</link>
			<pubDate>Wed, 17 Apr 2013 08:15:19 +0000</pubDate>
			<description>I am (student) just switched to linux working on NoC (noxim) simulator in ubuntu 12.04 c++ is supported assignment from university, I want to make a script that call my whole program multiple times (for loop= e.g 10) and want to take average value from the functions that were called ...</description>
			<content:encoded><![CDATA[ <p>I am (student) just switched to linux working on NoC (noxim) simulator in ubuntu 12.04 c++ is supported assignment from university, I want to make a script that call my whole program multiple times (for loop= e.g 10) and want to take average value from the functions that were called from other files. Should I create a new file for script? if yes then which header files should I call in that.</p>

<p>and how to create log file of the above mentioned output, if simulation takes hours. I want for each iteration the value is saved and in the end whole output is declared as an array or string.</p>

<p>Need Help in this, help me as soon as possible if there is any error so I can discuss with you people.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>saadi068</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/452678/creating-script-and-taking-average-from-calling-function</guid>
		</item>
				<item>
			<title>substitution of two variables using shell sed script</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/451713/substitution-of-two-variables-using-shell-sed-script</link>
			<pubDate>Thu, 04 Apr 2013 21:59:21 +0000</pubDate>
			<description>my input file contais this text DOPC 1024 PW 30903 CL- 1 arg01 1 My output file should be DOPC 1024 PW 100 CL- 10 arg01 1 I have used this following command for the single substitution and it works well. read no_water read length sed s/&quot;PW 30903&quot;/&quot;PW $no_water&quot;/ arg01.top ...</description>
			<content:encoded><![CDATA[ <p>my input file contais this text</p>

<pre><code class="language-sh">DOPC    1024
PW      30903
CL-     1
arg01   1
</code></pre>

<p>My output file should be</p>

<pre><code class="language-sh">DOPC    1024
PW      100
CL-     10
arg01   1
</code></pre>

<p>I have used this following command for the single substitution and it works well.</p>

<pre><code class="language-sh">read no_water
read length


sed s/"PW      30903"/"PW      $no_water"/ arg01.top &gt;arg$length.top
</code></pre>

<p>But I want to do two substitutions by one sed command. Is it possible?<br />
I have tried like this but it doesn't work</p>

<pre><code class="language-sh">sed -e s/"PW      30903"/"PW      $no_water"/ ; s/"CL-     1"/"CL-     $length"/ &lt;arg01.top &gt;arg$length.top
</code></pre>

<p>Can anyone help me in this regard?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>sudipta.mml</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/451713/substitution-of-two-variables-using-shell-sed-script</guid>
		</item>
				<item>
			<title>Find next monday on given date</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/451662/find-next-monday-on-given-date</link>
			<pubDate>Thu, 04 Apr 2013 09:32:29 +0000</pubDate>
			<description>Hi, I have dates like 20130402 (y-m-d i.e 2ndApr13) Dates are 20130402, 20130404, 20130409, 20130412 if date is 20130402 out put is 20130408 , if date is 20130412 output is 201304015 dd=&quot;20130402&quot; echo $dd This gives me current dates next monday , date -d &quot;next monday&quot; +%Y%m%d How to find ...</description>
			<content:encoded><![CDATA[ <p>Hi,</p>

<p>I have dates like 20130402 (y-m-d i.e 2ndApr13)<br />
Dates are 20130402, 20130404, 20130409, 20130412</p>

<p>if date is 20130402 out put is 20130408 , if date is 20130412 output is 201304015</p>

<p>dd="20130402"<br />
echo $dd<br />
This gives me current dates next monday , date -d "next monday" +%Y%m%d<br />
How to find the next monday of this given date?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>Aamit</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/451662/find-next-monday-on-given-date</guid>
		</item>
				<item>
			<title>Validating input in Shell - Help</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/451308/validating-input-in-shell-help</link>
			<pubDate>Sun, 31 Mar 2013 02:52:33 +0000</pubDate>
			<description>Hi, I am trying to write a small shell script that will take user input on SVN branch and validate that the requested branch exists in SVN. And then continue with other operations if the branch is valid. I tried the following but seems its not working right: VALID_BRANCHES=&quot;4.2.1 4.1.0 ...</description>
			<content:encoded><![CDATA[ <p>Hi,<br />
I am trying to write a small shell script that will take user input on SVN branch and validate that<br />
the requested branch exists in SVN. And then continue with other operations if the branch is valid.<br />
I tried the following but seems its not working right:</p>

<pre><code class="language-sh">VALID_BRANCHES="4.2.1 4.1.0 4.3.1 4.2.2"

for brnache in $VALID_BRANCHES
do 
    echo "Checking if $brnache is a valid branch in SVN"
    if [ "$1" != "$brnache" ];
    then
        echo "it isn't"
        continue
    else
        echo "$1 is a valid branch"
        break
    fi
done
</code></pre>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>boshu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/451308/validating-input-in-shell-help</guid>
		</item>
				<item>
			<title>awk</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/450791/awk</link>
			<pubDate>Sat, 23 Mar 2013 14:05:07 +0000</pubDate>
			<description>$ awk -F &quot;:&quot; 'NR!=1 {print $1}' test1.txt what does this mean?? especially &quot;:&quot;??</description>
			<content:encoded><![CDATA[ <p>$ awk -F ":" 'NR!=1 {print $1}' test1.txt<br />
what does this mean?? especially ":"??</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>pooh1234qwerty</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/450791/awk</guid>
		</item>
				<item>
			<title>need tutorials for shell scripting</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/450726/need-tutorials-for-shell-scripting</link>
			<pubDate>Fri, 22 Mar 2013 12:41:45 +0000</pubDate>
			<description>i am a beginner. i need online tutorial for shell scripting. there are many on the web.. which one to choose??</description>
			<content:encoded><![CDATA[ <p>i am a beginner. i need online tutorial for shell scripting. there are many on the web.. which one to choose??</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>pooh1234qwerty</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/450726/need-tutorials-for-shell-scripting</guid>
		</item>
				<item>
			<title>How to validate the user in linux Server </title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/450645/how-to-validate-the-user-in-linux-server-</link>
			<pubDate>Thu, 21 Mar 2013 13:35:10 +0000</pubDate>
			<description>Hi I want to check wether user exist in server or not uisng shell script? can any one help me regarding this</description>
			<content:encoded><![CDATA[ <p>Hi<br />
 I want to check wether user exist in server or not uisng shell script?<br />
can any one help me regarding this</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>arunkumarch</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/450645/how-to-validate-the-user-in-linux-server-</guid>
		</item>
				<item>
			<title>shell script</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/449911/shell-script</link>
			<pubDate>Tue, 12 Mar 2013 23:19:27 +0000</pubDate>
			<description>Write a shell script, guess.sh that implements a simple number guessing game. When run, the shell script prompts the user to guess a random number between 0 and 100. If the user guesses incorrectly, the script prompts the user “Guess higher” or “Guess lower” as appropriate and allows the user ...</description>
			<content:encoded><![CDATA[ <p>Write a shell script, guess.sh that implements a simple number guessing game.<br />
When run, the shell script prompts the user to guess a random number between 0<br />
and 100.</p>

<p>If the user guesses incorrectly, the script prompts the user “Guess<br />
higher” or “Guess lower” as appropriate and allows the user to guess again.</p>

<p>If the user guesses correctly, the script terminates printing out how many guesses the<br />
user needed.<br />
For example:</p>

<p>Guess my secret number (0­-100): 101<br />
Thats not between 0 and 100<br />
Guess my secret number (0­-100): 80<br />
Guess higher<br />
Guess my secret number (0­-100): 85Guess lower<br />
Guess my secret number (0­1-00): 82<br />
Right! You guessed my secret in 3 guesses.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>Akshay nand</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/449911/shell-script</guid>
		</item>
				<item>
			<title>Get web pages and compare</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/449289/get-web-pages-and-compare</link>
			<pubDate>Tue, 05 Mar 2013 14:07:24 +0000</pubDate>
			<description>Hello I'm writing a script to get content of web pages on different machines and compare them using their md5 hash hear is my code #!/bin/bash # Cluster 1 CLUSTER1_SERVERS=&quot;srv01:7051 srv02:7052 srv03:7053 srv04:7054&quot; CLUSTER1_APPLIS=&quot;test/version.html test2/version.html test3/version.jsp test4/version.html test5/version.jsp&quot; # Cluster 2 CLUSTER2_SERVERS=&quot;srv01:7055 srv02:7056 srv03:7057 srv04:7058&quot; CLUSTER2_APPLIS=&quot;test/version.html test2/version.html test3/version.jsp test4/version.html&quot; # ...</description>
			<content:encoded><![CDATA[ <p>Hello</p>

<p>I'm writing a script to get content of web pages on different machines and compare them using their md5 hash</p>

<p>hear is my code</p>

<pre><code class="language-sh">#!/bin/bash

# Cluster 1
CLUSTER1_SERVERS="srv01:7051 srv02:7052 srv03:7053 srv04:7054"
CLUSTER1_APPLIS="test/version.html test2/version.html test3/version.jsp test4/version.html test5/version.jsp"

# Cluster 2
CLUSTER2_SERVERS="srv01:7055 srv02:7056 srv03:7057 srv04:7058"
CLUSTER2_APPLIS="test/version.html test2/version.html test3/version.jsp test4/version.html"

# Cluster 4
CLUSTER4_SERVERS="srv01:7063 srv02:7064 srv03:7065 srv04:7066"
CLUSTER4_APPLIS="test/version.html test2/version.html"

# Liste des clusters �* tester
CLUSTERS="CLUSTER1 CLUSTER2 CLUSTER4"

# init vars
CRITICAL=2
WARNING=1
OK=0

for cluster in $CLUSTERS
do
        for server in $(eval echo \$${cluster}_SERVERS)
        do
        server_name=`echo $server | cut -d':' -f1,1`
        server_port=`echo $server | cut -d':' -f2,2`
        for applis in $(eval echo \$${cluster}_APPLIS)
        do
            checksum=`curl --silent --write-out '%{http_code}\n' "<a href="#">http://$server_name:$server_port/$applis</a>" | md5sum`
            if [[ ( "$checksum" -ne "$checksum1" ) ]]
            then
            exit_code=2
            else
            exit_code=0
            fi
        done
    done
done

case $exit_code in
        "2")
                echo "CRITICAL - App Version Mismatch"
                exit $CRITICAL
                ;;
        "0")
                echo "OK - All apps deployed are identical"
                exit $OK
                ;;
        *)
                echo "CRITICAL - there's something wrong with this script ..."
                exit $CRITICAL
                ;;
esac
</code></pre>

<p>getting web pages content and generation md5 hash works perfectly</p>

<p>but I'm a blocked when comparing them</p>

<pre><code class="language-sh">if [[ ( "$checksum" -ne "$checksum" ) ]]
</code></pre>

<p>can you guide me how i could accomplish this</p>

<p>thanks in advance<br />
gtam</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>gtam</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/449289/get-web-pages-and-compare</guid>
		</item>
				<item>
			<title>Create a new folder on an FTP site</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/448875/create-a-new-folder-on-an-ftp-site</link>
			<pubDate>Wed, 27 Feb 2013 18:32:30 +0000</pubDate>
			<description>Hello, I’m trying to make a powershell script that will copy files to and FTP server, but the destination folder needs to be generated each time the copy starts. In lieu of having a ton of issues trying to copy the source folder onto a remote FTP site using powershell, ...</description>
			<content:encoded><![CDATA[ <p>Hello,</p>

<p>I’m trying to make a powershell script that will copy files to and FTP server, but the destination folder needs to be generated each time the copy starts. In lieu of having a ton of issues trying to copy the source folder onto a remote FTP site using powershell, I thought of maybe just adding a piece to my shell script which will pre-create a folder with a specific name before starting the file copy. This way, the files will have a place to go besides the root share on the FTP server. I'm able to connect to the FTP site and manually use the makedir command, but articulating that into a script is proving troublesome.</p>

<p>Does anyone have an example of a simple powershell script that will create a folder on an FTP directory?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>MadJako</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/448875/create-a-new-folder-on-an-ftp-site</guid>
		</item>
				<item>
			<title>Copy a folder to an FTP directory using Powershell</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/threads/448778/copy-a-folder-to-an-ftp-directory-using-powershell</link>
			<pubDate>Tue, 26 Feb 2013 19:38:00 +0000</pubDate>
			<description>Good Morning, I'm new to Powershell and i'm attempting to create a script which will copy a folder to a spesific directory on an FTP site. I did some Googling and all I seem to come up with are ways to copy the folder contents, but not the folder itself. ...</description>
			<content:encoded><![CDATA[ <p>Good Morning,</p>

<p>I'm new to Powershell and i'm attempting to create a script which will copy a folder to a spesific directory on an FTP site. I did some Googling and all I seem to come up with are ways to copy the folder contents, but not the folder itself. Is there a easy to copy an entire folder to an FTP site using Powershell?</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>MadJako</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/threads/448778/copy-a-folder-to-an-ftp-directory-using-powershell</guid>
		</item>
			</channel>
</rss>