URL
https://opencores.org/ocsvn/s1_core/s1_core/trunk
Subversion Repositories s1_core
[/] [s1_core/] [trunk/] [tools/] [bin/] [test_var] - Rev 110
Compare with Previous | Blame | View Log
#!/bin/bash
# This script is not supposed to be run stand-alone, it is usually included by other scripts
# to check that an environment variable is set and that the corresponding directory does exist.
if (test $# != 1) then
echo "Usage: $0 VAR_NAME"
exit 1;
fi
var_name=$1
eval dir_name=\$$var_name
if [ -z "$dir_name" ]; then
echo "***ERROR***: Environment variable $var_name is undefined, please set it in the sourceme file and source it."
exit 1
fi
if [ ! -d "$dir_name" ]; then
echo "***ERROR***: Directory $dir_name does not exist, please check it and run 'source sourceme' again."
exit 1
fi