Lionel Blog

The road is under your feet, the heart looks to the distance

How to Use do-while Loops in Shell Scripts

Practical Examples of Infinite Loops in Bash

Bash에서 do-while 패턴을 사용하여 무한 루프를 구현하고, 시스템 정보를 주기적으로 확인하는 방법을 소개합니다.

while true; do cat /sys/devices/platform/f01d0000.adc/iio:device0/in_voltage3_raw; sleep 1; done
while true; do cat /sys/devices/platform/f01d0000.adc/iio:device0/in_voltage3_raw; done
while true; do free -h; sleep 1; echo "---"; done