help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Syntax for if test


From: Greg Wooledge
Subject: Re: [Help-bash] Syntax for if test
Date: Mon, 5 Dec 2011 11:19:22 -0500
User-agent: Mutt/1.4.2.3i

On Mon, Dec 05, 2011 at 08:59:41AM -0700, Eric Blake wrote:
> On 12/05/2011 08:21 AM, Bill Gradwohl wrote:
> > if [ $(echo "${templateMachine}"|egrep -q '\.')

> Try:
> if { [ -n "$TemplateMachine" ]

Bill was looking for a literal period, so -n "$foo" isn't equivalent.

In bash, it's simply:  if [[ $templateMachine = *.* ]]

In POSIX, you have to use case:

case $templateMachine in
  *.*) ...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]