Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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.