Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 unix 任务,而我的工作不正常。它不像普通的“cal”函数那样格式化。
#!/bin/bash d=`date '+%Y'`; $((++d)); calstr=`cal $d`; echo $calstr;
You don't need the $ in line 2, and you need to wrap the $calstr in double quotes:
$
$calstr
#!/bin/bash d=`date '+%Y'`; ((++d)); calstr=`cal $d`; echo "$calstr";