perl -E '$i=@{[`zypper lr`]}-2;map{`zypper rr $_`}1..$i'
What would be a good way to write this perl-onliner in bash. ( I would like to remove all repositores with zypper)?
perl -E '$i=@{[`zypper lr`]}-2;map{`zypper rr $_`}1..$i'
What would be a good way to write this perl-onliner in bash. ( I would like to remove all repositores with zypper)?
Here's a way to do this:
The first command counts the number of lines produced by zypper lr
command.
So, you obtain that by:
COUNT_LINES=`zypper lr|tail +3|wc -l`
The second command merely runs zypper rr [NUMBER]
for each number 1 through the counter; so you run the for
loop in bash as shown in this SO question:
zypper lr | grep -P "^\d" | cut -d'|' -f 1 | xargs sudo zypper rr
But much easier to simply:
sudo rm -rf /etc/zypp/repos.d/*