Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Date and time of execution of a program

Writer Sophia Terry

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.

3

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"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy