Re: Pipes
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>) |