Results 1 to 9 of 9

Thread: Zypper remove many packages

  1. #1
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default Zypper remove many packages

    Is it possible to remove multiple packages listed in a text file? Similar to "cat orphan.txt | zypper rm" or "zypper rm <orphan.txt." Neither worked.

    Thanks.

  2. #2

    Default Re: Zypper remove many packages

    Hello ionmich,

    Quote Originally Posted by ionmich
    Is it possible to remove multiple packages listed in a text file? Similar to "cat orphan.txt | zypper rm" or "zypper rm <orphan.txt." Neither worked.

    Thanks.
    There are probably lots of ways to do this, here's one:
    Code:
    zypper rm `cat orphan.txt`
    Good luck!
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

  3. #3
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,134

    Default Re: Zypper remove many packages

    Have not tried this, but I would expect
    zypper rm `cat orphan.text`

  4. #4
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,854
    Blog Entries
    14

    Default Re: Zypper remove many packages

    Quote Originally Posted by eng-int View Post
    Have not tried this, but I would expect
    zypper rm `cat orphan.text`
    or

    Code:
    for i in `cat orphans.txt`;
    do zypper rm $i
    done
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  5. #5
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,854
    Blog Entries
    14

    Default Re: Zypper remove many packages

    Quote Originally Posted by Edward_Iii View Post
    Code:
    zypper rm `cat orphan.txt`
    Wrong. This tries to remove the packages named "cat" and "orphan.txt".
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  6. #6

    Default Re: Zypper remove many packages

    Knurpht wrote:
    > Edward_Iii;2384496 Wrote:
    > Code:
    > --------------------
    > > > zypper rm `cat orphan.txt`

    > --------------------
    >
    > Wrong. This tries to remove the packages named "cat" and "orphan.txt".


    What do you think backquotes do in the shell?

  7. #7

    Default Re: Zypper remove many packages

    Hello Knurpht,

    Quote Originally Posted by Knurpht
    Wrong. This tries to remove the packages named "cat" and "orphan.txt".
    It works for me, note that it's a ` not a ' or ".
    Where did I put my coffee cup?
    dir -R /home/* | grep "coffee cup"

  8. #8
    Join Date
    Jun 2009
    Location
    Pennsylvania, USA
    Posts
    233

    Default Re: Zypper remove many packages

    Quote Originally Posted by Edward_Iii View Post
    Hello Knurpht,


    It works for me, note that it's a ` not a ' or ".
    That's one reason the POSIX syntax for command substitution uses $( ) instead

    Code:
    zypper rm $(cat orphan.txt)
    Another is that $()s can be nested(for the reeeeally hairy shell scripts) without very ugly quote mixing.

    The back quotes have been deprecated for at least 10 years.
    Use the Source, Luke

  9. #9
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default Re: Zypper remove many packages

    Thanks all. I like the script. Simple.

Posting Permissions

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