When I run a shell script. It shows some errors. I run script on centOS 5.5.

This is the part of my shell script where its show error.

PART OF CODE

if ! id service >/dev/null 2>&1
then
    doit 'CREATING "service" user' 'whereis adduser -c SERVICE -d /home/service -u 2000 -g 2000 -s /bin/bash service ; echo service | passwd --stdin service'
fi

doit code

doit ()
{
    local msg=$1
    shift
    if [ "$msg" ]
    then
        echo "$msg"
    fi
    if [ -z "$DONOTHING" ]
    then
        eval $*
    fi
}

ERROR

CREATING "service" user
adduser: /usr/sbin/adduser /usr/share/man/man8/adduser.8.gz
whereis [ -sbmu ] [ -SBM dir ... -f ] name...
passwd: Unknown user name 'service'.
有帮助吗?

解决方案

I think you just need to drop whereis from your command.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top