我正在用这个
DATE_FOLDER=$(date +"%b-%d-%a-%G") FILENAME="HOME_$date1.tar.gz" echo $BACKUP_DESTINATION/$DATE_FOLDER/$FOLDERNAME_$FILENAME
我的输出是
home/May-04-Wed-2011/HOME_May-04-0718PM-2011.tar.gz
但是如果我用 -下划线代替_
-
_
echo $BACKUP_DESTINATION/$DATE_FOLDER/$FOLDERNAME-$FILENAME
那我的输出是正确的
/home/May-04-Wed-2011/vmware-HOME_May-04-0717PM-2011.tar.gz
这是为什么?
_是变量名的有效字符,并且$FOLDERNAME_不存在。
$FOLDERNAME_
echo "$BACKUP_DESTINATION/$DATE_FOLDER/${FOLDERNAME}_$FILENAME"