Output unix time in alias
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
3
down vote
favorite
I'm running an online store where I can put a variable versiontag to includes JS and CSS as a cachebuster. I. e.
styles.css?v2018_01
Wherein the 2018_01
is the version tag. Now I also have a CLI tool that makes it quick to set like so
mr config:set 'design/head/meta_version_tag' [insert_my_var_here]
And what I want to do is create a Bash alias that sets the variable to the Unix timestamp whenever it is run. I know I can get the Unix timestamp with date +%s
.
So I would make an alias like this:
mr config:set 'design/head/meta_version_tag' date +%s
But the CLI interprets the date +%s
as a string, rather than getting its output first.
So what I need is an output like this:
mr config:set 'design/head/meta_version_tag' 1519747390
And so my question is; how can I get the output of the unix datestamp in my alias?
bash time alias
add a comment |Â
up vote
3
down vote
favorite
I'm running an online store where I can put a variable versiontag to includes JS and CSS as a cachebuster. I. e.
styles.css?v2018_01
Wherein the 2018_01
is the version tag. Now I also have a CLI tool that makes it quick to set like so
mr config:set 'design/head/meta_version_tag' [insert_my_var_here]
And what I want to do is create a Bash alias that sets the variable to the Unix timestamp whenever it is run. I know I can get the Unix timestamp with date +%s
.
So I would make an alias like this:
mr config:set 'design/head/meta_version_tag' date +%s
But the CLI interprets the date +%s
as a string, rather than getting its output first.
So what I need is an output like this:
mr config:set 'design/head/meta_version_tag' 1519747390
And so my question is; how can I get the output of the unix datestamp in my alias?
bash time alias
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'm running an online store where I can put a variable versiontag to includes JS and CSS as a cachebuster. I. e.
styles.css?v2018_01
Wherein the 2018_01
is the version tag. Now I also have a CLI tool that makes it quick to set like so
mr config:set 'design/head/meta_version_tag' [insert_my_var_here]
And what I want to do is create a Bash alias that sets the variable to the Unix timestamp whenever it is run. I know I can get the Unix timestamp with date +%s
.
So I would make an alias like this:
mr config:set 'design/head/meta_version_tag' date +%s
But the CLI interprets the date +%s
as a string, rather than getting its output first.
So what I need is an output like this:
mr config:set 'design/head/meta_version_tag' 1519747390
And so my question is; how can I get the output of the unix datestamp in my alias?
bash time alias
I'm running an online store where I can put a variable versiontag to includes JS and CSS as a cachebuster. I. e.
styles.css?v2018_01
Wherein the 2018_01
is the version tag. Now I also have a CLI tool that makes it quick to set like so
mr config:set 'design/head/meta_version_tag' [insert_my_var_here]
And what I want to do is create a Bash alias that sets the variable to the Unix timestamp whenever it is run. I know I can get the Unix timestamp with date +%s
.
So I would make an alias like this:
mr config:set 'design/head/meta_version_tag' date +%s
But the CLI interprets the date +%s
as a string, rather than getting its output first.
So what I need is an output like this:
mr config:set 'design/head/meta_version_tag' 1519747390
And so my question is; how can I get the output of the unix datestamp in my alias?
bash time alias
bash time alias
edited Feb 27 at 17:02
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
![](https://i.stack.imgur.com/E0SEH.png?s=32&g=1)
David Foerster
26.4k1362106
26.4k1362106
asked Feb 27 at 16:04
![](https://i.stack.imgur.com/AdGEB.jpg?s=32&g=1)
![](https://i.stack.imgur.com/AdGEB.jpg?s=32&g=1)
Alex Timmer
15911
15911
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
6
down vote
accepted
Provided you use bash
you can use Command Substitution:
mr config:set 'design/head/meta_version_tag' $(date +%s)
This will first run date +%s
in a subshell and include the output as a string, see man bash
under EXPANSION/Command Substitution:
Bash performs the expansion by executing
command
and replacing
the
command substitution with the standard output of the command, with any
trailing newlines deleted.
There's no need to quote the command substitution (like you would normally do) in this case, as the output of date +%s
doesn't have any whitespaces.
add a comment |Â
up vote
2
down vote
How about
mr config:set 'design/head/meta_version_tag' $(date +%s)
Or,
alias dothething='mr config:set "design/head/meta_version_tag" $(date +%s)'
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
Provided you use bash
you can use Command Substitution:
mr config:set 'design/head/meta_version_tag' $(date +%s)
This will first run date +%s
in a subshell and include the output as a string, see man bash
under EXPANSION/Command Substitution:
Bash performs the expansion by executing
command
and replacing
the
command substitution with the standard output of the command, with any
trailing newlines deleted.
There's no need to quote the command substitution (like you would normally do) in this case, as the output of date +%s
doesn't have any whitespaces.
add a comment |Â
up vote
6
down vote
accepted
Provided you use bash
you can use Command Substitution:
mr config:set 'design/head/meta_version_tag' $(date +%s)
This will first run date +%s
in a subshell and include the output as a string, see man bash
under EXPANSION/Command Substitution:
Bash performs the expansion by executing
command
and replacing
the
command substitution with the standard output of the command, with any
trailing newlines deleted.
There's no need to quote the command substitution (like you would normally do) in this case, as the output of date +%s
doesn't have any whitespaces.
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
Provided you use bash
you can use Command Substitution:
mr config:set 'design/head/meta_version_tag' $(date +%s)
This will first run date +%s
in a subshell and include the output as a string, see man bash
under EXPANSION/Command Substitution:
Bash performs the expansion by executing
command
and replacing
the
command substitution with the standard output of the command, with any
trailing newlines deleted.
There's no need to quote the command substitution (like you would normally do) in this case, as the output of date +%s
doesn't have any whitespaces.
Provided you use bash
you can use Command Substitution:
mr config:set 'design/head/meta_version_tag' $(date +%s)
This will first run date +%s
in a subshell and include the output as a string, see man bash
under EXPANSION/Command Substitution:
Bash performs the expansion by executing
command
and replacing
the
command substitution with the standard output of the command, with any
trailing newlines deleted.
There's no need to quote the command substitution (like you would normally do) in this case, as the output of date +%s
doesn't have any whitespaces.
edited Feb 27 at 16:21
answered Feb 27 at 16:08
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
![](https://i.stack.imgur.com/9L8vd.png?s=32&g=1)
dessert
20k55795
20k55795
add a comment |Â
add a comment |Â
up vote
2
down vote
How about
mr config:set 'design/head/meta_version_tag' $(date +%s)
Or,
alias dothething='mr config:set "design/head/meta_version_tag" $(date +%s)'
add a comment |Â
up vote
2
down vote
How about
mr config:set 'design/head/meta_version_tag' $(date +%s)
Or,
alias dothething='mr config:set "design/head/meta_version_tag" $(date +%s)'
add a comment |Â
up vote
2
down vote
up vote
2
down vote
How about
mr config:set 'design/head/meta_version_tag' $(date +%s)
Or,
alias dothething='mr config:set "design/head/meta_version_tag" $(date +%s)'
How about
mr config:set 'design/head/meta_version_tag' $(date +%s)
Or,
alias dothething='mr config:set "design/head/meta_version_tag" $(date +%s)'
answered Feb 27 at 16:09
waltinator
20.7k74168
20.7k74168
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1010333%2foutput-unix-time-in-alias%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password