about quote in command

Sjoerd Mullender sjoerd at acm.org
Thu Dec 6 20:19:43 UTC 2007


On 2007-12-06 20:11, Sjoerd Mullender wrote:
> On 2007-12-06 18:59, adrian kok wrote:
>> Hi all
>>
>> how can I make the quote correct?
>>
>> `tail -n 1 `date "+%Y-%m-%d-%H"`.txt`
>>
>> `date "+%Y-%m-%d-%H"`.txt is file
>>
>> thank you
>>
>> Send instant messages to your online friends http://uk.messenger.yahoo.com 
>>
> 
> All of these should work:
> 
> `tail -n 1 \`date "+%Y-%m-%d-%H"\`.txt`
> 
> $(tail -n 1 $(date "+%Y-%m-%d-%H").txt)
> 
> $(tail -n 1 \`date "+%Y-%m-%d-%H"\`.txt)

I forgot to remove the backslashes here, it should be:
$(tail -n 1 `date "+%Y-%m-%d-%H"`.txt)

> `tail -n 1 $(date "+%Y-%m-%d-%H").txt`
> 


-- 
Sjoerd Mullender




More information about the fedora-list mailing list