Below is a code snippet
以下是代码段
function currmonth
{
curr_mon=`echo $(date +%x)`
yy=`echo $curr_mon| awk '{print substr(
Below is a code snippet
以下是代码段
function currmonth
{
curr_mon=`echo $(date +%x)`
yy=`echo $curr_mon| awk '{print substr($0,9,2)}'`
mm=`echo $curr_mon| awk '{print substr($0,1,2)}'`
dd=`echo $(date -d "$mm/1 + 1 month - 1 day" "+%d")` # <--
}
function test
{
echo $(currmonth.dd) # <--
}
I want to call the attribute "dd" which is in function "currmonth" to the function test I tried using the .'DOT' operator to echo it but doesnt help,can u assist me with this
我想把函数“currmonth”中的属性“dd”调用到函数测试中我尝试使用.'DOT'操作符来回显但是没有帮助,你可以帮助我吗
1 个解决方案
#1
1
dd is a variable. You can print its value with:
dd是一个变量。您可以使用以下方式打印其值:
function test
{
echo $dd
}
currmonth # call currmonth()
test # call test()
,9,2)}'`
mm=`echo $curr_mon| awk '{print substr(
Below is a code snippet
以下是代码段
function currmonth
{
curr_mon=`echo $(date +%x)`
yy=`echo $curr_mon| awk '{print substr($0,9,2)}'`
mm=`echo $curr_mon| awk '{print substr($0,1,2)}'`
dd=`echo $(date -d "$mm/1 + 1 month - 1 day" "+%d")` # <--
}
function test
{
echo $(currmonth.dd) # <--
}
I want to call the attribute "dd" which is in function "currmonth" to the function test I tried using the .'DOT' operator to echo it but doesnt help,can u assist me with this
我想把函数“currmonth”中的属性“dd”调用到函数测试中我尝试使用.'DOT'操作符来回显但是没有帮助,你可以帮助我吗
1 个解决方案
#1
1
dd is a variable. You can print its value with:
dd是一个变量。您可以使用以下方式打印其值:
function test
{
echo $dd
}
currmonth # call currmonth()
test # call test()
,1,2)}'`
dd=`echo $(date -d "$mm/1 + 1 month - 1 day" "+%d")` # <--
}
function test
{
echo $(currmonth.dd) # <--
}
functio