Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm reading Unix Programming Environment.There is a sample program

echo "time is 'date'"

with output as

time is {current time}

But in ubuntu's bash shell it is not giving output as expected.It prints whole line as it is

 time is 'date'

Why is that? and Is it okay to read outdated book to learn Linux OS?

share|improve this question
    
You might consider migrating this question to unix.stackexchange.com or superuser.com. –  Andrew Case Sep 24 '11 at 16:32
add comment

2 Answers

up vote 3 down vote accepted

You want to use the following instead:

echo "time is `date`"

` (backtick) instead of ' (apostrophe)

The Unix/Linux foundation is the same, but a lot of utilities change over time so their options differ widely over time. Even between flavors they differ. So an older book is usually fine as most things will still work and are still accurate. A newer book would give you better use of newer features that didn't exist in the old days.

share|improve this answer
    
Thank you very much. –  Furqan Sep 24 '11 at 16:31
add comment

You can also use echo "time is $(date)" to avoid confusing single quote with backstick.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.