zypper search helper script

If you are using a lot of repositories you may want to examine upgrade paths for your packages. This little script helps me,
/usr/local/bin/zyppersa

#!/bin/bash
# zypper search all  - (upgradable packages)
#
# - i586 is excluded - I am using amd64
# - enables searches for a nobody user  if zypper is used/locked by root
#
ARCHEXCLUDE="i586"
if  "$USER" = "root" ] ; then
   su nobody -c "zypper se -s $1" | grep '^[iv]' | grep -v ${ARCHEXCLUDE}
else
   zypper se -s $1 | grep '^[iv]' | grep -v  ${ARCHEXCLUDE}
fi

It still works OK with Zypper and openSUSE 12.3 (64 bit only). If run without any command line option, it lists every package installed or could be installed. For such a case, I would pipe it through less like this:

Save as text file ~/bin/zs

#!/bin/bash
# zypper search all  - (upgradable packages)
#
# - i586 is excluded - I am using amd64
# - enables searches for a nobody user  if zypper is used/locked by root
#
ARCHEXCLUDE="i586"
if  "$USER" = "root" ] ; then
   su nobody -c "zypper se -s $1" | grep '^[iv]' | grep -v ${ARCHEXCLUDE} | less
else
   zypper se -s $1 | grep '^[iv]' | grep -v  ${ARCHEXCLUDE} | less
fi

run terminal command to mark executable:

chmod +x ~/bin/zs

If you do ask for a package, the list is much smaller. To use type in:

zs 

for all packages OR

zs package_name

For more specific information on the package you want.

James