回声后不显示输出

时间:2019-07-15 12:46:35

标签: bash shell unix scripting

我正在尝试根据某个命令的结果来格式化我的输出。但是,它没有打印出来。你们能让我知道我错过了什么吗?

VID=$(grep -iE $vvwwn ${TPAR_TEMP}/vvid_${TPAR_NAME} > ${TPAR_TEMP}/tvvid 2> /dev/null)

    TVVID=$(cat ${TPAR_TEMP}/tvvid |awk '{print$3}' 2> /dev/null)

            if [ "${TVVID}" = "32" ]; then
                            sh templ1
                            echo "$VID"
                   else
                            sh templ2 
                            echo "$VID"     
            fi

templ1

#!/bin/bash

echo "========================================================================================================"
awk '
BEGIN {printf "%-27s %-6s %-32s %-8s %-8s %-9s %-4s\n" , "Name", "State", "VV_WWN", "VSize_MB", "Usr_Used_MB", "UsrCPG", "Prov"}'
echo "========================================================================================================"

1 个答案:

答案 0 :(得分:0)

问题是$VID由于命令grep -iE $vvwwn ${TPAR_TEMP}/vvid_${TPAR_NAME} > ${TPAR_TEMP}/tvvid中的重定向而为空,为了使问题更容易填写,并在终端中运行命令。