Shell脚本验证目录名称和设置环境变量

时间:2016-10-10 17:28:24

标签: bash shell scripting

验证/验证目录名称并根据for循环中的$ d设置环境变量的脚本。 但如果验证不起作用。 请求帮助

for d in */; do
# Will print */ if no directories are available
echo $d
#tempdir='mkdir /home/Dinesh_Sadu/Scripting/Run-$d'
pwd=dinesh_S
`cd /home/Dinesh_Sadu/Scripting`
tempfile=`mkdir -p Run_$pwd`
`cp mkdir_p.sh $tempfile.txt`
var="$d"
echo "*****"$var
if [ $var = "a" ]; then
    echo "Dinesh Sadu in A"
    export sandbox="/home/Dinesh/aaaa
fi
if [ $var = "b" ]; then
    echo "Dinesh Sadu B"
    export sandbox="/home/Dinesh/bbb
fi   
echo "######:$sandbox"
done

用于验证/验证目录名称和设置环境变量的脚本

0 个答案:

没有答案