How can date and time of execution of a program be loaded at middle of a program. Every time I use exec date command it seems to ignore everything beneath it.
1 Answer
From help exec
:
exec: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
Replace the shell with the given command.
You don't want to replace the current shell (which will prevent script execution from reaching any subsequent commands): just use date
echo "HELLO"
date
echo "HI"
exec
in that context: it replaces the current shell with the command you give it. If you need more specific advice then post an example of code.