All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nico -telmich- Schottelius <nico-linux-udev@schottelius.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: Finding sysfs mount point
Date: Wed, 04 May 2005 17:51:36 +0000	[thread overview]
Message-ID: <20050504175136.GF2082@schottelius.org> (raw)
In-Reply-To: <d4rmhh$vjk$1@sea.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

Christian Borntr?ger [Fri, Apr 29, 2005 at 09:09:47AM +0200]:
> On Friday 29 April 2005 06:48, Greg KH wrote:
> > cat /proc/mounts | grep sysfs | cut -f 2 -d " "
> 
> if sysfs is mounted several times, this results in a non useful value for 
> scripting. what about
> 
> cat /proc/mounts | grep -m 1 sysfs | cut -f 2 -d " "
> 
> to get the first available mountpoint?

None of those expamples is reliable, when other paths contain
'sysfs'.

Simply use awk for it, it's build for such things:

   awk '$3 ~ /sysfs/ { print $2; exit }' /proc/mounts

This will catch wrong sysfs mounts and also display only the first
match.

Nico

-- 
Keep it simple & stupid, use what's available.
Please use pgp encryption: 8D0E 27A4 is my id.
http://nico.schotteli.us | http://linux.schottelius.org

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

      parent reply	other threads:[~2005-05-04 17:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-28 22:08 Finding sysfs mount point Ian Pilcher
2005-04-29  4:48 ` Greg KH
2005-04-29  7:09 ` Christian Bornträger
2005-05-04 17:51 ` Nico -telmich- Schottelius [this message]

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=20050504175136.GF2082@schottelius.org \
    --to=nico-linux-udev@schottelius.org \
    --cc=linux-hotplug@vger.kernel.org \
    /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 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.