Results 1 to 5 of 5

Thread: zypper one liner to show patch-info for available patches?

  1. #1

    Question zypper one liner to show patch-info for available patches?

    Anyone have a good console one liner to output the patch-info for all available patches?

    something like:
    zypper lp | cut ??? | zypper patch-info

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: zypper one liner to show patch-info for available patches?

    While you can of course make every bunch of bash commands into a one liner by putting everything on one line with ; at the end of each command, that does not make it more understandable .

    The following does shoe nice results here:
    Code:
    #!/bin/bash
    zypper ref
    zypper lp | grep 'Update' | while IFS='|' read X P X
    do      zypper patch-info ${P}
    done
    And that can be typed in one long line as:
    Code:
    zypper ref ; zypper lp | grep 'Update' | while IFS='|' read X P X ; do zypper patch-info ${P} ; done
    Well, the forums software may brake down this into two lines, but it is in facct one line.
    Henk van Velden

  3. #3

    Default Re: zypper one liner to show patch-info for available patches?

    nice one, thanks

  4. #4

    Default Re: zypper one liner to show patch-info for available patches?

    Hi,

    This is my version, without the grep.

    Code:
    zypper lp | while IFS='|' read -ra line; do [[ ${line[0]} = *update* ]] && zypper patch-info "${line[1]}"; done
    or

    Code:
    while IFS='|' read -ra line; do [[ ${line[0]} = *update* ]] && zypper patch-info "${line[1]}"; done < <(zypper lp)
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5

    Default Re: zypper one liner to show patch-info for available patches?

    You should add these to commandlinefu.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •