0

我有一个 unix 任务,而我的工作不正常。它不像普通的“cal”函数那样格式化。

#!/bin/bash

d=`date '+%Y'`;
$((++d));
calstr=`cal $d`;
echo $calstr;
4

1 回答 1

1

You don't need the $ in line 2, and you need to wrap the $calstr in double quotes:

#!/bin/bash

d=`date '+%Y'`;
((++d));
calstr=`cal $d`;
echo "$calstr";
于 2013-06-30T04:14:37.603 回答