Can somebody help on this:
I'm want to execute some commands in shell script by reading them from another text file something like this:
command_file.txt contains :
EXECUTED_OK_$(date)
EXECUTED_OK_$(hostname)
shell script.sh
#!/bin/sh
while read command
do
echo $command
done < command_file.txt
My problem is, echo prints as it is text as in the command file. How can I make it expand and print actual date and hostname.
For example Expected output should be:
EXECUTED_OK_22-02-2010 11:10:10
EXECUTED_OK_localhost
But I'm getting:
EXECUTED_OK_$(date)
EXECUTED_OK_$(hostname)