Hehe, that's too easy

I did programm something myself to add users

<?php
[...]
exec ('htpasswd and more code to add user');
[...]
?>

now I need to delete one single user from the .htpasswd file


the command to do this is "htpasswd -D .htpasswd username" but my htpasswd command does not support the -D option

I'd like to do something like this



Code:
#!/bin/bash

users=`cat /path/to/.htpasswd`

$searchFor =`cat /path/to/.htpasswd | grep $1`

for Name in $users
do
#if $name is not the username to be deleted write to a tmp file
if [$Name != $searchFor]
write $name to /path/to/htpasswd.tmp
fi
done
mv /path/to/htpasswd.tmp /path/to/.htpasswd
done
so I can call the script with
$ ./script.sh username


Develish ;D