Re: Q: Help needed - works on Linux RH9 but not on a Solaris box
From: Ed Morton (mortonAVOIDINGSPAM_at_Lucent.com)
Date: 09/04/03
- Next message: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Previous message: Ed Morton: "Re: Shell Script Question ( Case conversion)"
- In reply to: Troll: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Next in thread: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Reply: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 04 Sep 2003 11:11:07 -0500
On 9/4/2003 11:05 AM, Troll wrote:
> Thanks Joe.
>
> So change it to something like?:
> $variable = `echo $1 | grep -c "[^0-9+-]"`
> if $variable -gt 0
Don't forget the [ and ].
Alternative 1, still echo-ing and grep-ing:
echo $1 | grep "[^0-9+-]" > /dev/null
if [ $? = 0 ]
Alternative 2, no echo, no grep:
case "$1" in
*[0-9+-]* ) echo good ;;
* ) echo bad ;;
esac
Regards,
Ed.
- Next message: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Previous message: Ed Morton: "Re: Shell Script Question ( Case conversion)"
- In reply to: Troll: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Next in thread: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Reply: Ed Morton: "Re: Q: Help needed - works on Linux RH9 but not on a Solaris box"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|