ASIC/FPGA Design and Verification Out Source Services
condition a batch bash script.
This is simple if in a bash batch. It is meant for me mainly.In a simple script that checks in / out all files, I did not check that I am at the right directory. The results I checkout all company files and checked them in and annoyed every one. Should I have checked for the correct location, a lot of the trouble would have saved.
All that is required is the following code:
ptxc="/vobs/vlsi_prj/kkk/project_lib/jjj"
p=`pwd`
if [ "$p" == "$ptxc" ]; then
#put your code here
else
#put an error message
echo not the right path
echo $p
echo $ptxc
fi
Another example is to run some commands only on a run server and not on a login one.
h1=`hostname`
h2=`echo $h1 | sed "s/psv[0-9]*\([a-zA-Z_]*\)[0-9]*\..*/\1/"`
if [ "$h2" == "log" ]; then
echo $h1" is not a run server"
exit
fi
if [ "$h2" != "run" ]; then
echo $h1" is not a run server"
exit
fi
#Put here your rest of the code