sed from a shell script - invalid command code
Malcolm Kay
malcolm.kay at internode.on.net
Thu Dec 11 02:56:17 PST 2003
On Thu, 11 Dec 2003 01:10, Jez Hancock wrote:
> #!/bin/sh
> sed=/usr/bin/sed
> passwd_file=/etc/passwd
>
> ignore_users="root|toor|daemon|operator|bin|tty|kmem|games|news|man|smmsp|b
>ind|uucp|xten|pop|nobody|mysql|www|sshd|ftp|cyrus"
>
> cmd="$sed -E -e '/^(#|$ignore_users)/d' -e 's/:.*//' $passwd_file"
>
> users=`cmd`
I believe you want
users=`eval $cmd`
for this line
> echo $users
Malcolm
More information about the freebsd-questions
mailing list