簡體   English   中英

在Makefile中將紀元時間從十進制轉換為十六進制

[英]converting epoch time from decimal to hex in Makefile

我想將二進制格式的紀元時間轉換為十六進制。 我可以通過以下命令在命令行中執行此操作

# epoxy time in decimal
me@bof:/auto/homes$ date +%s
1400687648

# epoxy time in hex
me@bof:/auto/homes$ printf "%x\n" $(date +%s)
537ccc3b

現在,我想在Makefiles中執行上述操作,我正在嘗試使用$(shell)命令,但是缺少某些內容。

identifier:
        $(shell date +%s) 
        $(shell printf "%x\n" $(date +%s))

以上內容可以幫助我。 謝謝

你忘了給date shell

identifier:
    printf "%x\n" $(shell date +%s)

為什么要在配方中使用$(shell ...)函數? 每個配方都已經在外殼中運行了……為什么要兩次呢? 我一直都在看這個,不知道它從哪里來。

嘗試:

identifier:
        date +%s
        printf "%x\n" $$(date +%s)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM