日期:2014-05-16  浏览次数:20739 次

shell 如何将以下两条表达式合成一条呢?


shell   如何将以下两条表达式合成一条呢?  

PMONTH=`date   +%m`
PMONTHFILE=monitor_`echo   "$PMONTH   -   1 "   |   bc`.log


------解决方案--------------------
#!/bin/sh

PMONTH=`date +%m`
PMONTHFILE=monitor_`echo "$PMONTH - 1 " | bc`.log
echo $PMONTHFILE

_file= "monitor_ "`expr \`date +%m\` \- 1` ".log "
echo ${_file}

_file= "monitor_ "`echo \`date +%m\` - 1 | bc` ".log "
echo ${_file}