All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make kill-dhclient.sh more readable
@ 2009-06-05  9:45 Seewer Philippe
       [not found] ` <4A28E91D.1000006-omB+W0Dpw2o@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Seewer Philippe @ 2009-06-05  9:45 UTC (permalink / raw)
  To: <initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

Checking for existing file is more readable than string comparison

---
diff --git a/modules.d/40network/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh
index 19f258a..fcebd32 100755
--- a/modules.d/40network/kill-dhclient.sh
+++ b/modules.d/40network/kill-dhclient.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
 for f in /tmp/dhclient.*.pid; do
-    [ "$f" != "/tmp/dhclient.*.pid" ] && kill $(cat $f)
+    [ -e $f ] && kill $(cat $f)
 done

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make kill-dhclient.sh more readable
       [not found] ` <4A28E91D.1000006-omB+W0Dpw2o@public.gmane.org>
@ 2009-06-05 11:06   ` Harald Hoyer
       [not found]     ` <4A28FC46.8070201-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Harald Hoyer @ 2009-06-05 11:06 UTC (permalink / raw)
  To: Seewer Philippe; +Cc: <initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

On 06/05/2009 11:45 AM, Seewer Philippe wrote:
> Checking for existing file is more readable than string comparison
>
> ---
> diff --git a/modules.d/40network/kill-dhclient.sh
> b/modules.d/40network/kill-dhclient.sh
> index 19f258a..fcebd32 100755
> --- a/modules.d/40network/kill-dhclient.sh
> +++ b/modules.d/40network/kill-dhclient.sh
> @@ -1,5 +1,5 @@
> #!/bin/sh
>
> for f in /tmp/dhclient.*.pid; do
> - [ "$f" != "/tmp/dhclient.*.pid" ] && kill $(cat $f)
> + [ -e $f ] && kill $(cat $f)
> done

but it involves a disk access :)
for the sake of speed :) (not that it matters much here.. )
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make kill-dhclient.sh more readable
       [not found]     ` <4A28FC46.8070201-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-06-05 14:41       ` David Dillow
  0 siblings, 0 replies; 3+ messages in thread
From: David Dillow @ 2009-06-05 14:41 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Seewer Philippe,
	<initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

On Fri, 2009-06-05 at 13:06 +0200, Harald Hoyer wrote:
> On 06/05/2009 11:45 AM, Seewer Philippe wrote:
> > Checking for existing file is more readable than string comparison
> >
> > ---
> > diff --git a/modules.d/40network/kill-dhclient.sh
> > b/modules.d/40network/kill-dhclient.sh
> > index 19f258a..fcebd32 100755
> > --- a/modules.d/40network/kill-dhclient.sh
> > +++ b/modules.d/40network/kill-dhclient.sh
> > @@ -1,5 +1,5 @@
> > #!/bin/sh
> >
> > for f in /tmp/dhclient.*.pid; do
> > - [ "$f" != "/tmp/dhclient.*.pid" ] && kill $(cat $f)
> > + [ -e $f ] && kill $(cat $f)
> > done
> 
> but it involves a disk access :)
> for the sake of speed :) (not that it matters much here.. )

To a ram disk. :)
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-05 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05  9:45 [PATCH] Make kill-dhclient.sh more readable Seewer Philippe
     [not found] ` <4A28E91D.1000006-omB+W0Dpw2o@public.gmane.org>
2009-06-05 11:06   ` Harald Hoyer
     [not found]     ` <4A28FC46.8070201-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-06-05 14:41       ` David Dillow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.