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

Re: OT: How to match a substring?



On Wed, Jan 14, 2004 at 11:59:12AM -0600, Kent West wrote:
> This oughtta be simple for your scripters out there . . .

Hi, Kent

You have to understand the difference between a pipe ``|'', and a
command substitution ``$(foo)'' (backticks can be used instead of $(),
when nesting isn't needed).

The script follows:

#!/bin/sh
case "$(uname -a | awk '{print $1}')" in
  Linux)
    echo "Hi, I'm Linus Torvalds & I pronounce Linux as Linux."
    ;;
  Solaris)
    echo "Hi, I'm Steven Soderbergh & I pronounce Solaris as Solaris."
    ;;
  *)
    echo "Hi, I don't know who I am & I can't even spell \`\`potato''."
    ;;
esac

Cheers,
Jan.

-- 
Jan Minar                   "Please don't CC me, I'm subscribed." x 9

Attachment: pgpsCfiNezmtQ.pgp
Description: PGP signature


Reply to: