bash
This code snippet measures the elapsed time of a script using Bash's built-in SECONDS
variable, simulating work with sleep 2
, and then calculates and displays the execution time.
start_time=$SECONDS # Simulate some work sleep 2 elapsed_time=$((SECONDS - start_time)) echo "Script took $elapsed_time seconds to run."
bash internaldata manipulationstime operationsmeasuring elapsed time