#if [[ abcfoobarbletch =~ 'foo(bar)bl(.*)' ]]; then echo matches; fi matches #bash --version GNU bash, version 3.00.16(1)-release (sparc-sun-solaris2.10) Copyright (C) 2004 Free Software Foundation, Inc. #uname -a SunOS t1000 5.10 Generic_118833-33 sun4v sparc SUNW,Sun-Fire-T1000 Solaris |
#if [[ abcfoobarbletch =~ 'foo(bar)bl(.*)' ]]; then echo matches; fi matches #bash --version GNU bash, version 3.00.16(1)-release (powerpc-ibm-aix5.1) Copyright (C) 2004 Free Software Foundation, Inc. #uname -a AIX aix 3 5 00C97AC04C00 powerpc unknown AIX |
#if [[ abcfoobarbletch =~ 'foo(bar)bl(.*)' ]]; then echo matches; fi #bash --version GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc. #uname -a Linux ubuntu 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64 GNU/Linux |
#if [[ abcfoobarbletch =~ 'foo(bar)bl(.*)' ]]; then echo matches; fi #bash --version GNU bash, version 4.0.24(0)-release (amd64-portbld-freebsd7.2) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. #uname -a FreeBSD freebsd.unix-center.net 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #0: Fri Oct 2 08:22:32 UTC 2009 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 |
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |