Changes

Jump to: navigation, search

Bash-nexj

1,059 bytes added, 11:30, 17 November 2010
Created page with ' <big><big> Continuous Integration Project - Bash</big></big> {{NexJ_Express Index}} ==Bash Scripting Resources== :[http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.ht…'


<big><big> Continuous Integration Project - Bash</big></big>
{{NexJ_Express Index}}
==Bash Scripting Resources==
:[http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html Tutorial]
:[http://arachnoid.com/linux/shell_programming.html Shell Programming]
: [http://www.linux.org/lessons/advanced/x1110.html Linux org]
===Tips===
*Watch the spaces
<source lang=bash>
if [ -d "$tmpInternal" ]; then
rm -r $tmpInternal >> $dateError.txt
elif [ -d "$tmpExternal" ]; then
rm -r $tmExternal >> $dateError.txt
fi
</source>


* The increment operator in bash
<source lang=bash>
while [ $revTmpInternal -lt $revInternal ]; do
((revTmpInternal++))
done
</source>


* to check if a file exists:
<source lang=bash>

if [ -f m.patch ]; then
rm *.patch
fi
</source>


* To check if multiple files exist:http://www.ducea.com/2009/03/05/bash-tips-if-e-wildcard-file-check-too-many-arguments/
<source lang=bash>
errors=$(ls Error*.txt 2> /dev/null | wc -l)
if [ "$errors" != "0" ]; then
rm Error*.txt
fi
</source>
:Also this solution @ http://kenfallon.com/?p=4
1
edit

Navigation menu