Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I ran in shell:

#! /bin/bash

log=monday

echo "Today is $log"

echo "Today is 'date'"

but the result is : Today is monday Today is 'date'

How do I make it display the day and date. Thank you for searching。

share|improve this question
add comment

1 Answer 1

The reason why you are echoing the literal string date is because you are using single-quotes.

To ensure that you echo the output of date you need to use back-ticks

i.e.

echo "Today is `date`"

This will output:

Today is Sun Apr  8 11:06:37 BST 2012
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.