Preloader image
DDD

리눅스

Linux - Loop bash script

작성자 관리자 (admin)
조회수 1,222
입력일 2021-11-11 16:11:47

-- sample 1 --
-- 10회 LOOP 후 종료

#!/bin/sh
COUNT=10

while [ $COUNT -gt 0 ]; do

  echo COUNT : $COUNT
  ls -al ./dir
  w
  let COUNT=COUNT-1
  tmout=0
  echo "----------------"
  sleep 2

done

-- sample 2 --
-- CTRL + C 키입력때까지 무한 반복

#!/bin/bash
while :
do
    echo "Press [CTRL+C] to stop.."
    sleep 1
done

^