How can I do "su -c 'cmd' user" from Linux in macOS? On Linux I execute:

su -c "ls -l /etc | mail -s filelist myname@gmail.com" - username


How does this work in macOS?
su - &lt;username&gt; -c "ls -l /etc | mail -s filelist myname@gmail.com"