All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lsmod01: keep the output in variables
Date: Thu, 10 Nov 2016 17:15:24 +0300	[thread overview]
Message-ID: <582480FC.70805@oracle.com> (raw)
In-Reply-To: <20161110113902.GB11677@rei.lan>



On 11/10/2016 02:39 PM, Cyril Hrubis wrote:
> Hi!
>>> Hmm since the foo=$() flattened the text into single line this diff
>>> would be pretty much useless.
>>
>> Sorry, but are you sure about that?
>>
>> [stas@kholmanskikh ~]$ lsmod_output=$(lsmod | awk '!/Module/{print $1,
>> $2, $3}' | sort)
>> [stas@kholmanskikh ~]$ echo "$lsmod_output" > /tmp/gg
>> [stas@kholmanskikh ~]$ tail -n 2 /tmp/gg
>> xt_state 1370 3
>> zlib_deflate 21991 1
>> [stas@kholmanskikh ~]$ modules_output=$(awk '{print $1, $2, $3}'
>> /proc/modules | sort)
>> [stas@kholmanskikh ~]$ echo "$modules_output" > /tmp/zz
>> [stas@kholmanskikh ~]$ tail -n 2 /tmp/zz
>> xt_state 1370 3
>> zlib_deflate 21991 1
>> [stas@kholmanskikh ~]$
>>
>> i.e. the content of /tmp/gg and /tmp/zz are in the form ready to be diff-ed.
> 
> You are right, the double quotes makes the difference here.
> 
> $ modules_output=$(awk '{print $1, $2, $3}' /proc/modules | sort)
> 
> $ echo $modules_output
> bluetooth 320499 5 btbcm 5506 1 btintel 2739 1 ...
> 
> $ echo "$modules_output"
> bluetooth 320499 5
> btbcm 5506 1
> btintel 2739 1
> ...
> 
> 
> Consider the patch acked then.

Thank you. Pushed.
> 

  reply	other threads:[~2016-11-10 14:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 11:08 [LTP] [PATCH] lsmod01: parse a copy of /proc/modules Stanislav Kholmanskikh
2016-08-29 12:50 ` Cyril Hrubis
2016-08-29 13:05   ` Stanislav Kholmanskikh
2016-08-29 13:34     ` Jan Stancek
2016-08-29 14:00       ` Stanislav Kholmanskikh
2016-08-29 14:03         ` Stanislav Kholmanskikh
2016-08-29 15:17           ` Cyril Hrubis
2016-08-29 15:49           ` Jan Stancek
2016-10-11 12:03             ` Stanislav Kholmanskikh
2016-10-11 13:38               ` Cyril Hrubis
2016-10-11 15:47                 ` Stanislav Kholmanskikh
2016-10-11 16:15                   ` Cyril Hrubis
2016-11-09 14:34                     ` [LTP] [PATCH] lsmod01: keep the output in variables Stanislav Kholmanskikh
2016-11-09 16:49                       ` Cyril Hrubis
2016-11-10 10:07                         ` Stanislav Kholmanskikh
2016-11-10 11:39                           ` Cyril Hrubis
2016-11-10 14:15                             ` Stanislav Kholmanskikh [this message]
2016-08-31 13:55 ` [LTP] [PATCH] lsmod01: parse a copy of /proc/modules Cyril Hrubis
2016-09-02 14:12   ` Stanislav Kholmanskikh

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=582480FC.70805@oracle.com \
    --to=stanislav.kholmanskikh@oracle.com \
    --cc=ltp@lists.linux.it \
    /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.