首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

shell 怎么将以下两条表达式合成一条呢

2012-02-04 
shell 如何将以下两条表达式合成一条呢?shell如何将以下两条表达式合成一条呢?PMONTH`date+%m`PMONTHFILE

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}

热点排行