shell help: check for regex in variable
William Park
opengeometry-FFYn/CNdgSA at public.gmane.org
Mon Mar 12 22:34:46 UTC 2007
On Mon, Mar 12, 2007 at 11:38:28AM -0400, Neil Watson wrote:
> How can I check that a variable ends in .pid?
>
> loose example
> pidfile="/var/run/myproc.pid"
>
> if [[ $pidfile contains ".*\.pid$" ]]
>
> Is this possible?
case $pidfile in
*.pid) echo ... ;;
esac
--
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list