I want to make an alias for randomly changing my mac addressalias chrandmac=sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')but the command substitution part is already resolved when executing the profile.alias chrandmac='sudo ifconfig en0 ether 83:3a:bf:fc:4e:29'Any thoughts as to why this occurs?
Command substitution in alias resolved in bash profile?
bash;freebsd;alias;profile;command substitution
You want to use a function instead of an alias. It can be put in your startup file just like an alias:chrandmac() {    sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')}In order to get it to work with an alias, you need to use single quotes to prevent the expansion of the command substitution.alias chrandmac='sudo ifconfig en0 ether $(openssl rand -hex 6 | sed '\''s/\(..\)/\1:/g; s/.$//'\'')'