[KLUG Members] Help! Samba LDAP 2.2.8a - can't add a machine

Peter Buxton members@kalamazoolinux.org
Fri, 16 Jan 2004 21:33:33 -0500


As long as we're critiquing Bourne style...

> > ...and yet I can't get Samba to add a machine account automatically.
> > I wrote a test script:
> > #!/bin/bash

> > echo `date` 1> output.txt

Um, just use:

date > output.txt

Backticks create a subshell, just as parentheses do. Not only is it
inefficient, but my example pipes stdout and stderr just as yours does.

> > /usr/bin/smbldap-useradd -w -d /dev/null -g machines -c 'Machine
> > Account' -s /bin/false $1 >> output.txt
> 
> And you know what the current working directory of this script is?  
> Add a "cd /tmp" after "#!/bin/bash".

If you're creating output.txt as a temporary file, use:

FILE=`mktemp` || exit 1

date > $FILE

...

rm $FILE
exit


-- 
I'm obsessed with mental hygiene.