9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Fco.J.Ballesteros <nemo@plan9.escet.urjc.es>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] walk
Date: Fri, 25 Jul 2003 16:07:28 +0200	[thread overview]
Message-ID: <32987a381a6dd9037ee880078b7f5b3d@plan9.escet.urjc.es> (raw)
In-Reply-To: <200307251359.h6PDx7704315@augusta.math.psu.edu>

there's also this single `walk' script that evaluates arbitrary expressions
on files, like in

;; walk . '~ $f *.c && test -r $f && cp $f /tmp'

its idea is simply to set $f to the file name and evaluate the command for each
file found in the tree. Works fine enough so I didn't bother to replace it.

#!/bin/rc

rfork e

if (~ $#* 0) {
	echo 'usage: walk file [cmd...]' >[1=2]
	exit usage
}

file=$1
shift
if (~ $#* 0)
	cmd='echo $f'
if not
	cmd=$*
cd `{basename -d $file}
exec du -a $file | awk '{print $2}' | while (f=`{read}) { eval $cmd  }



  reply	other threads:[~2003-07-25 14:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-25  6:36 pac
2003-07-25 13:59 ` Dan Cross
2003-07-25 14:07   ` Fco.J.Ballesteros [this message]
2003-07-29 17:40     ` [9fans] VMWare workstation-4.0? Ishwar Rattan
2003-07-29 18:26       ` andrey mirtchovski
2003-07-25 14:16   ` [9fans] walk Charles Forsyth
2003-07-25 15:31     ` Dan Cross
  -- strict thread matches above, loose matches on Subject: below --
2003-07-24  9:03 pac
2003-07-24  9:21 ` boyd, rounin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32987a381a6dd9037ee880078b7f5b3d@plan9.escet.urjc.es \
    --to=nemo@plan9.escet.urjc.es \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).