Sleep after the second loop in a shell script

2023-07-20 11:48 (2 years ago)
Staggered Silence
Play a song themed on this article

Here's the translation of the provided Japanese blog article into English:


When processing redundant items one by one, you may need to sleep after the second loop to avoid doing everything at once.

#!/usr/bin/env zsh

sleep_command=""
for i in {1..3} ; do
    eval ${sleep_command}
    echo ${i}
    sleep_command="sleep 10"
done

Please rate this article
Current rating: 5.0 (2)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive