The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-02-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,764
If the installable file can be identified accurately by name only -
you really should have a checksum for it as well.
Code:
#!/bin/ksh
# i made up the checksum value :)  i'm using md5 - you can use cksum or whatever
mychecksum="2d786401096622f33b2cbed35c1bee39"  
file_to_execute=$(find / -type f  -user root -name install_file)
thischecksum=$(md5 $file_to_execute)

if [[ "$thischecksum" = "$mychecksum" ]] ; then
   $file_to_execute parm1 parm2 
else
   echo "no valid file found"
fi