[clue] Bash baffler

Quentin Hartman qhartman at gmail.com
Wed Jun 4 17:41:07 MDT 2014


You might want to consider using the contents of /proc/mounts instead of
the output of df as your source of mounted file systems. /proc/mounts is
easier to parse and it's the canonical source for mount information.
Sometimes df will lie to you. Google  "df does not show all mounts" for
relevant circumstances.

For example, your awk and grep could be replaced with just "grep ^/dev
/proc/mounts" and require no more trimming or manipulation.

QH


On Wed, Jun 4, 2014 at 5:17 PM, <foo7775 at comcast.net> wrote:

> Much appreciated Vishal, that makes complete sense.  I spent enough time
> testing it with different combinations of backticks, etc. that I'm not at
> all surprised that something like that slipped through.  I'll tweak it a
> bit *(either later tonight, or early tomorrow)* & try it again.
>
> Thanks again.
>
> T.
>
> ------------------------------
> *From: *"Vishal Verma" <stellarhopper at gmail.com>
> *To: *"list, CLUE" <clue at cluedenver.org>
> *Sent: *Wednesday, June 4, 2014 5:04:22 PM
>
> *Subject: *Re: [clue] Bash baffler
>
> But the real problem is you're using both $() and ``
> It is trying to execute the text output of `df -hl  | awk '{print
> $NF}' | grep -v ^\/dev` and feeding it into another subshell as a
> command, which of course it isn't.
>
> -Vishal
>
> On Wed, Jun 4, 2014 at 4:59 PM, Vishal Verma <stellarhopper at gmail.com>
> wrote:
> > On Wed, Jun 4, 2014 at 4:53 PM,  <foo7775 at comcast.net> wrote:
> >> df -hl  | awk '{print $NF}' | grep -v ^\/dev
> >
> > The 'on' seems to be coming from the last column of the 'header' of
> > the df command:
> > Filesystem      Size  Used Avail Use% Mounted on
> >
> > You want something like:
> > df -hl  | grep -v "^Filesystem" | awk '{print $NF}' | grep -v ^\/dev
> >
> > -Vishal
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20140604/9c0c94e8/attachment.html 


More information about the clue mailing list