Hey all,
Here's my dilemma:
- I'm a newbie at scripting!
- 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!
Hey all,
Here's my dilemma:
Is there a way to do this or am I wasting my time???
Thanx in advance!
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!