# convert from octal to symbolic format function o2s () { touch ~/.octal2symbolic; chmod -vv "$@" $_; ls -l $_ | awk '{print $1}'; rm -f ~/.octal2symbolic; } #function o2s () { touch ~/.octal2symbolic; chmod "$@" $_; ls -l $_ | awk '{print $1}'; rm -f ~/.octal2symbolic; } o2s 755 o2s 644 o2s 1744 o2s 0100751 # cf. man 2 stat (st_mode) o2s 0101751 # Cf. Bash 'umask' builtin doesn't set 'x' permissions? # http://archives.devshed.com/forums/unix-linux-135/bash-umask-builtin-doesn-t-set-x-permissions-372356.html UMASKO=$(umask) # 0022 help umask umask umask -p umask -S umask 0077 umask umask -S o2s 755 umask 0000 umask umask -S o2s 654 umask $UMASKO # convert from symbolic to octal format # default file permissions of temporary file: chmod 777 ~/.symbolic2octal function s2o () { touch ~/.symbolic2octal; chmod 777 $_; chmod "$@" $_; stat -f %p $_; rm -f ~/.symbolic2octal; } s2o a-x s2o u=rwx,g=rx,o=x s2o u=rwx,g=rx,o=x,+t