Register
It is currently Sun Apr 22, 2018 9:45 pm

Command with variable in bash


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Feb 08, 2018 1:04 am   

Joined: Thu Feb 08, 2018 12:50 am
Posts: 1
Hey all members,

I have a question concerning to use a variable in a command.
Code:
cucumber --format pretty --format json --out=reports/out.json features/complete_big_FM.feature -t [email protected]

In out=reports should be the output file named with the actually date. Somthing like
Code:
cucumber --format pretty --format json --out=reports/actualdatenow.json features/complete_big_FM.feature -t [email protected]

How can I do this?

Thank you for your help.


Top
 Profile  
 PostPosted: Thu Feb 08, 2018 2:08 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 642
hi,

basic command substitution :
Code:
UrComd ...--option=path/$(date +<dateFormat>)...
if you intend to reuse the value, then you could use a variable:
Code:
var=$(command)
UrComd ... --option="$var"...
anotherComd "$var"


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP