make sed global in case of subdomains

This commit is contained in:
Matthew Saunders Brown 2024-05-16 11:02:19 -07:00
parent a60e85b9fb
commit 463c5a74c9

View File

@ -40,8 +40,8 @@ fi
# check for and set username (length between 3 and 12 characters) # check for and set username (length between 3 and 12 characters)
if [[ -z "$username" ]]; then if [[ -z "$username" ]]; then
strippeddomain=`echo $domain | sed 's|\.||'` strippeddomain=`echo $domain | sed 's|\.||g'`
strippeddomain=`echo $strippeddomain | sed 's|-||'` strippeddomain=`echo $strippeddomain | sed 's|-||g'`
username=`echo ${strippeddomain:0:8}` username=`echo ${strippeddomain:0:8}`
if grep -q "^$username:" /etc/passwd; then if grep -q "^$username:" /etc/passwd; then
# username already exists, try another # username already exists, try another