“Bash mendapatkan cap waktu” Kode Jawaban

Dapatkan shell timestamp saat ini

// If you want to get unix timestamp, then you need to use:
timestamp=$(date +%s)
GutoTrosla

Bash mendapatkan cap waktu

# put current date as yyyy-mm-dd in $date
# -1 -> explicit current date, bash >=4.3 defaults to current time if not provided
# -2 -> start time for shell
printf -v date '%(%Y-%m-%d)T\n' -1 

# put current date as yyyy-mm-dd HH:MM:SS in $date
printf -v date '%(%Y-%m-%d %H:%M:%S)T\n' -1 

# to print directly remove -v flag, as such:
printf '%(%Y-%m-%d)T\n' -1
# -> current date printed to terminal
Encouraging Eland

cap waktu dalam pesta

timestamp=`date +%Y%m%d%H%M%S`
curl -s http://mywebsite.com/myscript.txt -o /tmp/.myscript.${timestamp}.tmp
bash /tmp/.myscript.${timestamp}.tmp
rm -f /tmp/.myscript.${timestamp}.tmp
alxTools

BASH Timestamp UNIX

date +%s 

# Give the number of seconds since epoch
Graceful Gull

Jawaban yang mirip dengan “Bash mendapatkan cap waktu”

Pertanyaan yang mirip dengan “Bash mendapatkan cap waktu”

Lebih banyak jawaban terkait untuk “Bash mendapatkan cap waktu” di Shell/Bash

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya