LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Variable or something else? (https://www.linuxquestions.org/questions/linux-general-1/variable-or-something-else-679973/)

wegadnie 10-30-2008 04:43 AM

Variable or something else?
 
Hi all,

i have a question. From command
#date +%F
it shows me the date in right format (2008-10-30) but when i issue the command
#touch 'date +%F'.log
it doesn't name the file in right name format which i expected (2008-10-30.log). The other guy can do on his box so i think the problem is my side. What should i do in this situation?

pixellany 10-30-2008 06:01 AM

Well, if we knew who "the other guy" was, we might be able to see what he was doing......;)

Seriously, is it possible that you used single quotes, when you needed to use backtics? To run a command and use its output inside another command, you need one of two forms:
command2 $(command1)
OR
command2 `command1`

In the second example, those are backtics (on a standard US Qwerty keyboard, top left--just above the tab key)

wegadnie 10-30-2008 06:52 AM

Got it. You're the man. Thanks a lot.


All times are GMT -5. The time now is 11:52 AM.