From owner-freebsd-current Sun May 19 0: 8:10 2002 Delivered-To: freebsd-current@freebsd.org Received: from marlborough.cnchost.com (marlborough.concentric.net [207.155.248.14]) by hub.freebsd.org (Postfix) with ESMTP id ED8E737B40B; Sun, 19 May 2002 00:08:01 -0700 (PDT) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by marlborough.cnchost.com id DAA27939; Sun, 19 May 2002 03:07:59 -0400 (EDT) [ConcentricHost SMTP Relay 1.14] Message-ID: <200205190707.DAA27939@marlborough.cnchost.com> To: Dima Dorfman Cc: Paul Herman , Giorgos Keramidas , current@FreeBSD.ORG Subject: Re: mergemaster(8) broken -- uses Perl In-reply-to: Your message of "Sun, 19 May 2002 06:26:12 -0000." <20020519062613.04B153E1A@turbine.trit.org> Date: Sun, 19 May 2002 00:07:58 -0700 From: Bakul Shah Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Paul Herman wrote: > > On Sun, 19 May 2002, Dima Dorfman wrote: > > > > > How about fixing ls(1) to output the numeric mode if asked to? > > > > That's good, but while you're at it you'd probably want to get > > *everything* out of (struct stat) and print it numerically (device, > > flags, atime since epoch, etc.) You could do this in ls(1), but > > I'll have a patch for fstat(1) soon (working on it) that gives you: > > > > bash$ /usr/obj/usr/src/usr.bin/fstat/fstat -s /tmp /kernel > > INODE DEV SIZE BLOCKS MODE FLAGS LNK UID GID ATIME MTIME CTIME NAME > > 235 226304 4114305 8096 100555 400000 1 0 0 1021779222 10217403541021740354 /kernel > > 56651 226304 512 4 041777 000000 6 0 0 1021787523 10217876571021787657 /tmp > > > > so you can parse it however you like. Either way, ls(1) or > > fstat(1), as long as you can get the info you need. :-) > > This looks much better than my extention. I look forward to seeing > this get into the tree. I have a yet another variation, called `stat'. It is like ls(1) except you specify what stat fields you want using a printf style format string. I added -n flag to print out numeric values instead of symbolic ones where it makes sense. I originally wrote it many years ago because access to stat fields from shell scripts is such a pain. Yours for asking. $ stat -h Usage: stat [-a | -f format] [-h] [-n] [-L] files... where options are: -a print all attributes -f format print using a printf like format -h this help message -L follow symbolic links -n prints numeric values not symbolic values The -f format is as follows: \ escapes are as in printf any other non % char is printed as is, %% prints a single % a stat field is printed using %[-][width][.width] format. - for left justification, width[.width] is as for %s format of printf can be one of: a file access time b allocated blocks c inode change time d dev f flags g group G generation l links m file modify time n file name p permissions: r=read w=write x=exec S=suid/sgid s=suid/sgid+x T=sticky t=sticky+x r raw dev s size t type: b=block c=char d=dir -=file p=fifo s=socket l=symlink w=whiteout u user The default format is "%t%p %2l %-6u %-6g %9s %m %n\n" Format for the -a option is "%a|%b|%c|%d|%f|%g|%G|%i|%l|%m|%p|%r|%s|%t|%u|%n\n" $ stat stat -rwxr-xr-x 1 bakul bakul 22523 May 18 23:46:16 2002 stat $ stat -a stat -- bakul To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message