Android日期更改scipt不工作
我写了一个简单的脚本来更改日期。当我在ADB中单独输入行时,它工作正常。当我在ADB中刷新脚本时,它会抛出错误(在Begging上带有@的历元编号)或错误地更改日期(2018年…)。代码如下:Android日期更改scipt不工作,android,date,datetime,sh,Android,Date,Datetime,Sh,我写了一个简单的脚本来更改日期。当我在ADB中单独输入行时,它工作正常。当我在ADB中刷新脚本时,它会抛出错误(在Begging上带有@的历元编号)或错误地更改日期(2018年…)。代码如下: #!/system/bin/sh currentdate=$(busybox date +%s) currentdate=$(($currentdate + 5400)) currentdate=$(busybox date -d @$currentdate +"%Y%m%d.%H%M%S") date
#!/system/bin/sh
currentdate=$(busybox date +%s)
currentdate=$(($currentdate + 5400))
currentdate=$(busybox date -d @$currentdate +"%Y%m%d.%H%M%S")
date -s $currentdate
我做错了什么?请尝试以下代码
currentdate=$(busybox date +%s)
currentdate=$((currentdate+5400))
date -s $(busybox date -s @$currentdate '+%Y%m%d.%H%M%S')