if [ "$1" = "*default*" ] ; then
cp ../stimulus/default_value.in ../log/$1.log
fi
When I issue the command run_test i2c_default_test in the command line, the cp command is not executed.
Whereas if i give the following code, the cp command gets ececuted.
if [ "$1" = "i2c_default_test" ] ; then
cp ../stimulus/default_value.in ../log/$1.log
fi
There are many tests with the "default" name. Hence i dont want to add if statement for every test. Can anyone tell me where i am going wrong in using the wild card comparison operator "*"
tags.
if [ "$1" = "*default*" ] ; then
cp ../stimulus/default_value.in ../log/$1.log
fi
When I issue the command run_test i2c_default_test in the command line, the cp command is not executed.
Whereas if i give the following code, the cp command gets ececuted.
if [ "$1" = "i2c_default_test" ] ; then
cp ../stimulus/default_value.in ../log/$1.log
fi
There are many tests with the "default" name. Hence i dont want to add if statement for every test. Can anyone tell me where i am going wrong in using the wild card comparison operator "*"
[/quote]
[indent]
The test command (a.k.a. [) doesn't take wildcards; it matches strings not patterns.
Use a case statement:
case $1 in
*default*) cp ../stimulus/default_value.in ../log/$1.log ;;
esac