问题描述:

Searching the internet I found explanations only for '[email protected]', meaning 'expand to positional parameters'. But I couldn't find anything about the @ sign by itself.

I stumbled over it in the third snipped of the accepted answer to this question:

http://superuser.com/questions/611538/is-there-a-way-to-display-a-countdown-or-stopwatch-timer-in-a-terminal

Specifically:

date -u --date @$((`date +%s` - $date1)) +%H:%M:%S

网友答案:

In the context you show, the @ is in the beginning of the --date argument to the date command:

date -u --date @$((`date +%s` - $date1)) +%H:%M:%S

In that case it means that the argument should be treated as the number of seconds since epoch, see an example in man date:

Convert seconds since the epoch (1970-01-01 UTC) to a date

$ date --date='@2147483647'

or:

$ date -u -d @0
Thu Jan  1 00:00:00 UTC 1970

This meaning of @ is defined by the date utility alone and not by bash.

相关阅读:
Top