From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18382 invoked by alias); 27 Feb 2012 18:26:57 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16803 Received: (qmail 17795 invoked from network); 27 Feb 2012 18:26:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at tj.luo.ma does not designate permitted sender hosts) Received-SPF: pass (google.com: domain of lists@tj.luo.ma designates 10.50.193.199 as permitted sender) client-ip=10.50.193.199; Authentication-Results: mr.google.com; spf=pass (google.com: domain of lists@tj.luo.ma designates 10.50.193.199 as permitted sender) smtp.mail=lists@tj.luo.ma MIME-Version: 1.0 Sender: lists@tj.luo.ma X-Originating-IP: [99.172.9.247] In-Reply-To: <20120227173749.36fa1d79@pwslap01u.europe.root.pri> References: <20120227173749.36fa1d79@pwslap01u.europe.root.pri> From: TJ Luoma Date: Mon, 27 Feb 2012 13:18:45 -0500 X-Google-Sender-Auth: zZ1yEJ8RrBMhM5PUguxWfRpbu2U Message-ID: Subject: Re: How to find owner of file or folder? To: zsh-users@zsh.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmqcR3D67JhLse4O7N8vXobTeIkmZFs+tSSkt86DhcLqPY44ViC49j2uhrFlk396SgNIeb6 Excellent! I knew there had to be a better way. Thanks, Peter. Here's a little script I wrote up which will show the owner if just one argument is given, or will shown the owner and filename if more than one argument is given: #!/bin/zsh zmodload -F zsh/stat b:zstat # if there's just one argument given, show the owner and exit if [ "$#" = "1" ] then zstat -s +uid "$@" exit fi # otherwise, loop through and shown the owner for each file which exists for F in $@ do [[ -e "$F" ]] || continue echo -n "$F: " zstat -s +uid "$F" done