Question:
How to write a unix bash shell script that prints each command, executes it, waits 1 second, and moves to the next command.
A unix bash shell script that prints each command, executes it, waits 1 second, and then moves to the next command.
You can easily change the commands to meet your requirements.
#!/bin/bash
# List of commands to run
commands=(
"date"
"ip a"
"ps aux | grep sw-cp-server"
"ls -l /usr/local/psa"
"plesk version"
"which plesk"
"ls -l /var/log/plesk"
)
# Loop over each command
for cmd in "${commands[@]}"; do
echo "Executing: $cmd" # 1) Write command to screen
eval "$cmd" # 2) Execute the command
sleep 1 # 3) Pause 1 second
echo "-------------------------------"
doneTaxonomy: