Hi,
With a awk script i create a "adduser line"
$ cat /tmp/tmp.ldif | awk -f ldif2adduser.awk
adduser --uid 1002 --gid 1000 --gecos "ROUSSIN Guy" --home /homeL/guy --shell /bin/bash --disabled-password guy
If i cut and paste this line, all is fine. But in a shell script i get errors :
# cat t.sh
#!/bin/bash
# ADDUSER=`cat /tmp/tmp.ldif | awk -f ldif2adduser.awk`
ADDUSER="adduser --uid 1002 --gid 1000 --gecos \"ROUSSIN Guy\" --home /homeL/guy --shell /bin/bash --disabled-password guy"
echo ${ADDUSER}
${ADDUSER}
# ./t.sh
adduser --uid 1002 --gid 1000 --gecos "ROUSSIN Guy" --home /homeL/guy --shell /bin/bash --disabled-password guy
Warning: The home dir /homeL/guy you specified already exists.
adduser: The user `Guy"' does not exist.
The problem is when there is spaces in --gecos param.
I tried some workaround but without success.
Thank you.
Guy