On Jan 30, 2008 2:42 PM, Dan Nicholson <[EMAIL PROTECTED]> wrote:
> On Jan 30, 2008 12:23 PM, Victor Lowther <[EMAIL PROTECTED]> wrote:
>
> > I am especially interested in a more robust version of 0003.
>
> I only looked at this patch. You can just use the return status of
> `type' for the function. No grepping is necessary.
Heh, should have caught that myself. Attached patch fixes that.
> --
> Dan
>
From dc2da0348717e51a8609214914109a63b797c832 Mon Sep 17 00:00:00 2001
From: Victor Lowther <[EMAIL PROTECTED]>
Date: Wed, 30 Jan 2008 14:46:34 -0600
Subject: [PATCH] Simplify the implimentation of command_exists
---
pm/functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pm/functions b/pm/functions
index beb7826..76aafd1 100755
--- a/pm/functions
+++ b/pm/functions
@@ -97,7 +97,7 @@ command_exists()
{
# $1 = command to test for. It can be an executable in the path,
# a shell function, or a shell builtin.
- type "$1" | grep -q -v "not found"
+ type "$1" >/dev/null 2>&1
return $?
}
--
1.5.3.8
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils