Open main menu

CDOT Wiki β

Nexjexpress/Bash

Revision as of 11:31, 17 November 2010 by Minooz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Continuous Integration Project - Bash

Bash Scripting Resources

Tutorial
Shell Programming
Linux org

Tips

  • Watch the spaces
if [ -d "$tmpInternal" ]; then
	rm -r $tmpInternal >> $dateError.txt 
elif [ -d "$tmpExternal" ]; then
	rm -r $tmExternal >> $dateError.txt 
fi


  • The increment operator in bash
while [ $revTmpInternal -lt $revInternal ]; do
	((revTmpInternal++))
done


  • to check if a file exists:
if [ -f m.patch ]; then
	rm *.patch
fi


errors=$(ls Error*.txt 2> /dev/null | wc -l)
if [ "$errors" != "0" ]; then
	rm Error*.txt
fi
Also this solution @ http://kenfallon.com/?p=4