ASIC/FPGA Design and Verification Out Source Services
A very simple script, demonstrating a way to detect a working directory.
-
Sometimes we want a script to work according to the current directory. In this case, I show how distinguish between the sub-system and unit level location.
#!/bin/bash
#detect sub-system or unit work directory
cmd="pwd | grep m3_testgroup_jobs"
eval $cmd >> /dev/null
if [ $? -eq 0 ] ; then
sub_system_flg="flase"
else
sub_system_flg="true"
fi
...
if [ "$sub_system_flg" = "true" ] ; then
-
A better way to do it is using string compare:
#!/bin/bash
p=`pwd`
q="m3_testgroup_jobs"
if [ $p == $q ] ; then
echo ok
fi
|