Register
It is currently Wed Apr 23, 2014 11:33 pm

Which way do you test for a program ?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Dec 27, 2005 2:53 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 657
Location: Des Moines, Iowa
Here are 3 styles of checking for an existing program...... anyone have another way, or a better way/different way. ???

Code:
if ! which slocate >/dev/null ; then
  echo " "
  echo "slocate is not detected";
  echo "you need it installed. Exiting...";
  false; exit;
fi

if [[ -z $( type -p mplayer ) ]]; then
  echo " "
  echo "mplayer is not detected";
  echo "you need it installed. Exiting...";
  false; exit;
fi

which convert &>/dev/null
  if [ $? != "0" ];
  then
   echo -e "ImageMagick -- NOT INSTALLED";
  else
   echo "ImageMagick -- Installed";
   fi


Top
 Profile WWW  
 PostPosted: Tue Feb 13, 2007 3:37 pm   

Joined: Tue Feb 06, 2007 2:25 pm
Posts: 13
Location: Liverpewl
maybe whereis? I'd probably go for the which though, as it's almost certain to be installed on a system, however slocate isn't.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP