Bash script to STOP installation 'if' a file exists...

Hey all,

Here's my dilemma:

  1. I'm a newbie at scripting!
  2. I need to create a script that checks: If a file size is equal to zero, then stop the installation.

Is there a way to do this or am I wasting my time???

Thanx in advance! :b:

Here's a simple example but understand testing for size also tests for file existence. use "-f" to just test if a file exists.

#!/bin/bash

if [ -s testfilename ]; then
  echo "Exists and has size"
else
  echo "Does not exist or has no size"
fi

exit 0

Read up on the manual page for test (the '[' character is a shortcut for the test command):

man test

thanx!