#!/bin/sh # StringContainsSymbol.sh # Wed Mar 18 16:19:59 PDT 2009 # Chieh Cheng # http://www.CynosureX.com/ # GNU General Public License (GPL) Version 2, June 1991 scriptName=`basename "$0"` usage () { echo " Usage: ${scriptName} \"string\"" } if [ $# -eq 1 ] then str="$1" # regular expression missing ']', because as soon as I put it # in, it fails to recognize symbols. echo "${str}" | grep -c "[\!\@\#\$\%\^\&\*\(\)\-\_\+\=\{\}\:\:\"\'\<\>\,\.\[\?\/\~\`\\]" else usage fi