Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Want to replace bash w zsh as system shell on Ubuntu

On Tuesday 02 February 2010 13:37:27 Frank Terbeck wrote:
> But $(...) is perfectly correct syntax in POSIX shells. You may be
> confused here, because older bourne shells don't support this. Shells
> that adhere the standard, however, do.

You're right. I thing the $(<file) cat-replacement was not transfered to posix 

> Yeah, it's also funny to suddenly end up with a number of your files
> being owned by root (shouldn't happen with zsh's history file, since zsh
> keeps track of the file's permissions even with the HIST_SAVE_BY_COPY
> option enabled - which is the default; but not everything is as cautious
> as zsh is).

You're right. That's pretty inconvenient using sudo but sudo is the only way 
to work with multiple administrators while each admin keeps it's own set of 
configuration files. On a single person system this doesn't matter.

You can always use an exit hook to clean your home directory after using sudo. 
Add something like this to your ~/.zshrc file. Upon exiting a sudo root 
sessions zsh changes the permissions of all files underneath $HOME which now 
don't have the UID or GID before running sudo and now have a UID or GID of the 
user you switched to (sudo -u postgres):

correct_permissions() {
  emulate -R zsh
  setopt extendedglob

  if [[ -n $SUDO_UID && -n $SUDO_GID ]] {
    print 'Correcting file permissions. This may take a while.'

    [[ -n ${matches} ]] && chown $SUDO_UID:$SUDO_GID "${matches[@]}"


Attachment: signature.asc
Description: This is a digitally signed message part.

Messages sorted by: Reverse Date, Date, Thread, Author