• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pipes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pipes


  • Subject: Re: Pipes
  • From: Juan Fuentes <email@hidden>
  • Date: Sun, 11 Jan 2004 03:55:17 -0400

On Jan 11, 2004, at 2:39 AM, Marc K. Myers wrote:

These are being used in shell scripts that I use to find matching processes in "ps" listings and matching files in "ls" listings. The first is "cprc" ("see processes") and the second is "cfle" ("see files"). Each is invoked with a single argument which is the string to be matched in the listing.

There's probably a way to debug what's going on inside a shell script but I haven't figured it out yet.

Marc [01/11/04 1:24:25 AM]


I think the problem is that you need to change to the files directory for grep to be able to access them,
grep doesn't know about paths etc.., at least that's what i've been able to gather,
but any how here is a way that works:

#!/bin/sh

file=`basename "$1"`
dir=`dirname "$1"`

cd $dir
LS=`ls -al | grep "$file" | grep -v grep`
echo "$LS"

Hope this helps,

Juan Fuentes
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Pipes (From: "Marc K. Myers" <email@hidden>)

  • Prev by Date: Re: Pipes
  • Next by Date: Re: Pipes
  • Previous by thread: Re: Pipes
  • Next by thread: Re: Pipes
  • Index(es):
    • Date
    • Thread