<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech-Recipes &#187; UNIX shell scripting</title>
	<atom:link href="http://www.tech-recipes.com/category/computer-programming/unix-shell-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tech-recipes.com</link>
	<description>Computer and technology tutorials and guides</description>
	<lastBuildDate>Thu, 09 Feb 2012 21:32:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bourne/bash shell scripts: string comparison</title>
		<link>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/</link>
		<comments>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 19:02:27 +0000</pubDate>
		<dc:creator>Rex</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>
		<category><![CDATA[BASH shell]]></category>
		<category><![CDATA[Bourne shell]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[Brief tutorial describing how to do string comparisons. Recently updated thanks to comments from our users.

Our original tutorial needed correcting for the case if $var is null.  We have updated our original article.
To determine if the value of a variable ($var) is empty (null):
if [ "$var" == "" ]
then
  echo variable is null
fi
To [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>A simple script that waits for a process to complete and then executes a command</title>
		<link>http://www.tech-recipes.com/rx/2275/a_simple_script_that_waits_for_a_process_to_complete_and_then_executes_a_command/</link>
		<comments>http://www.tech-recipes.com/rx/2275/a_simple_script_that_waits_for_a_process_to_complete_and_then_executes_a_command/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 14:00:44 +0000</pubDate>
		<dc:creator>bxj</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[It is often necessary under unix/linux to wait for certain processes to complete before running other processes.  At best this can cause needless delays and wasted time, while in the worst cases someone may actually forget to run some final processing.

The script we are going to create is a simple script that will loop [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/2275/a_simple_script_that_waits_for_a_process_to_complete_and_then_executes_a_command/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple Menu for User Input</title>
		<link>http://www.tech-recipes.com/rx/983/simple-menu-for-user-input/</link>
		<comments>http://www.tech-recipes.com/rx/983/simple-menu-for-user-input/#comments</comments>
		<pubDate>Fri, 02 Sep 2005 11:15:05 +0000</pubDate>
		<dc:creator>gevery77</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[This script will create an input screen in BASH that allows the user to enter information just as they would in a window. This is to show the use of simple functions as well as the tput command. &#8220;tput cup&#8221; allows the developer to place the cursor anywhere on the screen. There are many more [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/983/simple-menu-for-user-input/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>simple function for print colorful text</title>
		<link>http://www.tech-recipes.com/rx/912/simple-function-for-print-colorful-text/</link>
		<comments>http://www.tech-recipes.com/rx/912/simple-function-for-print-colorful-text/#comments</comments>
		<pubDate>Wed, 08 Jun 2005 03:01:52 +0000</pubDate>
		<dc:creator>hpx</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[function to print text with colors(not contain all the colors)
can be extened easily

function print_color {
	local text=$1
	local fg=$2
	local bg=$3
	#change to right form
	case "$fg" in
		red)	fg="31m" ;;
		green)	fg="32m" ;;
		yellow) fg="33m" ;;
		blue)	fg="34m" ;;
		white)	fg="37m" ;;
		black)	fg="30m" ;;
		*)		fg="37m" ;;
	esac
	case "$bg" in
		red)	bg="41m" ;;
		green)	bg="42m" ;;
		yellow) bg="43m" ;;
		blue)	bg="44m" ;;
		white)	bg="47m" ;;
		black)	bg="40m" ;;
		*)		bg="40m" ;;
	esac
	echo -en "\033[$fg\033[$bg$text\033[0m"
}

]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/912/simple-function-for-print-colorful-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>queue and stack using array</title>
		<link>http://www.tech-recipes.com/rx/911/queue-and-stack-using-array/</link>
		<comments>http://www.tech-recipes.com/rx/911/queue-and-stack-using-array/#comments</comments>
		<pubDate>Wed, 08 Jun 2005 02:49:10 +0000</pubDate>
		<dc:creator>hpx</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[here is a series of operation on array,
we can use these functions to implement a queue or stack that can help us more

push:
array=(&#8220;${array[@]}&#8221; $new_element)
pop:
array=(${array[@]:0:$((${#array[@]}-1))})
shift:
array=(${array[@]:1})
unshift
array=($new_element &#8220;${array[@]}&#8221;)
function del_array {
	local i
	for (( i = 0 ; i < ${#array[@]} ; i++ ))
	do
		if [ "$1" = "${array[$i]}" ] ;then
			break
		fi
	done
	del_array_index $i
}
function del_array_index {
	array=(${array[@]:0:$1} ${array[@]:$(($1 + 1))})
}
]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/911/queue-and-stack-using-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>bash array operations</title>
		<link>http://www.tech-recipes.com/rx/910/bash-array-operations/</link>
		<comments>http://www.tech-recipes.com/rx/910/bash-array-operations/#comments</comments>
		<pubDate>Wed, 08 Jun 2005 02:26:36 +0000</pubDate>
		<dc:creator>hpx</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[sometimes we need  to remove one element from an array
for example we remove the element 2 (third) from array


array=(&#8220;hello&#8221; &#8220;i&#8221; &#8220;like&#8221; &#8220;bash&#8221;)
i=2
array=(${array[@]:0:$i} ${array[@]:$(($i + 1))})

]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/910/bash-array-operations/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>bash shell script accessing array variables</title>
		<link>http://www.tech-recipes.com/rx/642/bash-shell-script-accessing-array-variables/</link>
		<comments>http://www.tech-recipes.com/rx/642/bash-shell-script-accessing-array-variables/#comments</comments>
		<pubDate>Tue, 31 Aug 2004 21:53:54 +0000</pubDate>
		<dc:creator>qmchenry</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[The bash shell allows a number of methods for accessing elements of variable arrays.  This recipe demonstrates some of these techniques.

Given the array defined by the following code:
names=( Jennifer Tonya Anna Sadie Molly Millie)
The individual elements in the array can be accessed by their numeric index (remember that they start counting a zero) with:
${names[0]} [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/642/bash-shell-script-accessing-array-variables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>bash shell script iterate through array values</title>
		<link>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/</link>
		<comments>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/#comments</comments>
		<pubDate>Mon, 30 Aug 2004 19:00:10 +0000</pubDate>
		<dc:creator>qmchenry</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[Having an array of variables is of no use unless you can use those values somehow.  This recipe shows a few methods for looping through the values of an array in the bash shell.

Given the array definition:
names=( Jennifer Tonya Anna Sadie )
The following expression evaluates into all values of the array:
${names[@]}
and can be used [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/636/bash-shell-script-iterate-through-array-values/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>bash shell script declaring/creating arrays</title>
		<link>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/</link>
		<comments>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/#comments</comments>
		<pubDate>Mon, 30 Aug 2004 15:57:43 +0000</pubDate>
		<dc:creator>qmchenry</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[The use of array variable structures can be invaluable.  This recipe describes several methods for declaring arrays in bash scripts.

The following are methods for declaring arrays:
names=( Jennifer Tonya Anna Sadie )
This creates an array called names with four elements (Jennifer, Tonya, Anna, and Sadie).
names=( "John Smith" "Jane Doe" )
This creates two array elements, each [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/635/bash-shell-script-declaringcreating-arrays/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Bourne/bash shell script functions</title>
		<link>http://www.tech-recipes.com/rx/541/bournebash-shell-script-functions/</link>
		<comments>http://www.tech-recipes.com/rx/541/bournebash-shell-script-functions/#comments</comments>
		<pubDate>Thu, 05 Aug 2004 21:36:59 +0000</pubDate>
		<dc:creator>Rex</dc:creator>
				<category><![CDATA[Bourne shell scripting]]></category>

		<guid isPermaLink="false">guid-fix-me!</guid>
		<description><![CDATA[Writing functions can greatly simplify a program.  If a chunk of code is used multiple times in different parts of a script, the code can be enclosed within a function and run using only the function name.

The following example decribes the use of functions in a Bourne shell script.
#!/bin/sh
sum() {
   x=`expr $1 [...]]]></description>
		<wfw:commentRss>http://www.tech-recipes.com/rx/541/bournebash-shell-script-functions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 7/18 queries in 1.092 seconds using memcached
Object Caching 640/687 objects using memcached

Served from: www.tech-recipes.com @ 2012-02-10 07:11:52 -->
