Skip to main content

Thread: help with a script


i need implement in larger script of mine, bash code check if packages installed, if yes, something, if not else.
can give me example code of how should it?

you can use dpkg(1) test installed packages:
code:
#!/bin/sh pkglist="dpkg foobar" pkg in $pkglist     dpkg -l $pkg >/dev/null 2>/dev/null     if [ $? -eq 0 ];         echo "package $pkg installed"     else         echo "package $pkg not installed"     fi done
code:
$ ./pkgtest.sh  package dpkg installed package foobar not installed


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support New to Ubuntu [ubuntu] help with a script


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support