I execute the script below as root within MAC OS X terminal. The piped command runs successfully, but the script fails at the chown command with the following error:
chown: Domain Users: illegal group name
Why?
See script below:
#!/bin/bash
echo Enter username
read Name
echo Enter number
read NUM
sudo -s "(cd /Users/$NAME && tar c .) | (cd /Users/$NUM && tar xf -)"
sudo chown -R $NUM:"Domain Users" /Users/$NUM
sudo chmod g+rwx /Users/$NUM