Hey Guys,
I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at that domain. The appending to the files is working fine but I am having one problem.
The problem I am having is when I try to run the script, I get this output.
machine1# ./newuser.sh
1) CreateNewUser
2) Quit
#? 1
Please enter your first name:
chris
Please enter name of domain:
./newuser.sh: line 16: USERNAME: command not found
Username test:
pw: invalid character `-' at position 0 in userid/group name
Below is the part of the code I am having trouble with.
OPTIONS="CreateNewUser Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "CreateNewUser" ]; then
echo "Please enter your first name:"
read USER
echo "Please enter name of domain:"
read DOMAIN
touch username
chmod 755 username
echo "$USER-$DOMAIN" >> username
USERNAME = `cut -c 1-15 username`
rm username
echo "Username test: $USERNAME"
pw useradd -n $USERNAME -m -s /usr/local/bin/bash -h 0
please let me know if you need any more information. I know the code is far from clean but I just want it working atm.
Thanks