General Question

rexpresso's avatar

In a *nix shell how can I touch a file naming it with the system's current UNIX timestamp?

Asked by rexpresso (922points) November 14th, 2010
2 responses
“Great Question” (0points)

I want to do a slightly more complex command, but from you I would just like enough help so I can issue a command like this:

$timestamp = unix_timestamp; touch $timestamp

Of course I’m such a newbie that obviously I’m wrong in this command. But I think you get my idea. Any help is precious!

Thanks!

Topics: , ,
Observing members: 0
Composing members: 0

Answers

sferik's avatar

touch `date +%s`

Backticks (on the same key as the tilde, next to 1/!) are really powerful. They work by evaling the contained command and then substituting the output.

You can do just about anything on the shell in a single line using backticks, pipes, and xargs.

Learn ‘em, love ‘em.

rexpresso's avatar

Absolutely fantastic! Thanks @sferik

Answer this question

Login

or

Join

to answer.

Mobile | Desktop


Send Feedback   

`