You are here: TWiki > Guides Web > ShellScripting r3 - 03 Apr 2007 - 17:36 - JesseSuen


Start of topic | Skip to actions

Quick Tips

Check if a directory is empty:

if [ $(ls /path/to/directory/ | wc -l) -eq 0 ] ; then
    echo "Directory empty"
fi 

Find and print files that contain a particular search string:

find . -name "*.log" -exec grep "search string" '{}' /dev/null \; -print

Check java version in a script

$ java -fullversion 2>&1 | awk -F\" '{print $2}'
1.6.0-b105

Resources

-- JesseSuen - 24 Jul 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback