Using date to get tomorrows date in Bash

2019-06-22 16:27发布

I want to write a bash script that will run on a given but process data with next days date, My current approach is to get the unix time stamp and add a days worth of seconds to it, but I cant get it working, and haven't yet found what I'm looking for online.

Here's what I've tried, I feel like the problem is that its a string an not a number, but I dont know enough about bash to be sure, is this correct? and how do I resolve this?

today="$(date +'%s')"

tomorrow="$($today + 86400)"

echo "$today"

echo "$tomorrow"

标签: bash shell unix
7条回答
欢心
2楼-- · 2019-06-22 17:10

I hope that this will solve your problem here.

 date --date 'next day'
查看更多
登录 后发表回答