Dup Goto 📝

Trapping Interrupts

PT2/shell/bash bash trap 10-02 13:53:54
To Pop
9 lines, 31 words, 173 chars Wednesday 2024-10-02 13:53:54
#!/bin/bash
trap trap_int SIGINT
trap_int() {
  echo "Trap int"
}
for i in {1..10}; do echo "$i"; sleep 1; done

Note trap_int is a string that will be evald.