目前,我有;
echo "Whats the year?"
read year
echo "Whats the Month you're running this for?"
read month
TARGET=`pwd`/"BLAH"$year$month"BLAH"
TARGET_888=`pwd`/"BLAH"$year$month"BLAH"
输出结果为:pwd / BLAH201312BLAH例如。有什么方法可以使用变量,所以在此之前不使用echo的定义TARGET和TARGET_888?我只是想让我的代码更整洁,而不是在我的代码中间有变量。
答案 0 :(得分:1)
您可以使用read -p
:
read -p "Whats the year?" year
read -p "Whats the Month you're running this for?" month
TARGET="$PWD/BLAH${year}${month}BLAH"
TARGET_888="$TAGET"