Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2003 21:26:07 +1030
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        Jez Hancock <jez.hancock@munk.nu>, FreeBSD Questions List <freebsd-questions@freebsd.org>
Subject:   Re: sed from a shell script - invalid command code
Message-ID:  <200312112126.07805.malcolm.kay@internode.on.net>
In-Reply-To: <20031210144058.GA81732@users.munk.nu>
References:  <20031210144058.GA81732@users.munk.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 11 Dec 2003 01:10, Jez Hancock wrote:
> #!/bin/sh
> sed=3D/usr/bin/sed
> passwd_file=3D/etc/passwd
>
> ignore_users=3D"root|toor|daemon|operator|bin|tty|kmem|games|news|man|s=
mmsp|b
>ind|uucp|xten|pop|nobody|mysql|www|sshd|ftp|cyrus"
>
> cmd=3D"$sed -E -e '/^(#|$ignore_users)/d' -e 's/:.*//' $passwd_file"
>
> users=3D`cmd`

I believe you want
  users=3D`eval $cmd`
for this line

> echo $users

Malcolm



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312112126.07805.malcolm.kay>