#!/bin/sh
<<'NOTES'
pauses your script then continues on either a single key press
or mouse click, works here with an xterm compatible terminal
Michael Sanders 2025
NOTES
pause() {
msg=${1:-"Press any key or click..."} # default message
printf '%s' "$msg"
old=$(stty -g)
printf '\033[?1000h'
stty raw -echo
dd bs=1 count=1 < /dev/tty 2>/dev/null
printf '\033[?1000l'
stty "$old"
}
pause "Your script has finished"
# eof
On 24.10.2025 02:11, Michael Sanders wrote:
#!/bin/sh
<<'NOTES'
pauses your script then continues on either a single key press
or mouse click, works here with an xterm compatible terminal
Michael Sanders 2025
NOTES
pause() {
msg=${1:-"Press any key or click..."} # default message
printf '%s' "$msg"
old=$(stty -g)
printf '\033[?1000h'
stty raw -echo
dd bs=1 count=1 < /dev/tty 2>/dev/null
printf '\033[?1000l'
stty "$old"
}
pause "Your script has finished"
# eof
What are all these ANSI terminal control commands doing?
What are all these ANSI terminal control commands doing?
On 2025-10-24, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 24.10.2025 02:11, Michael Sanders wrote:
printf '\033[?1000h'
printf '\033[?1000l'
What are all these ANSI terminal control commands doing?
1000h enables mouse events being reported; 1000l disables it.
[...]
Incidentally I encountered some similar codes just recently and wondered
what they are doing; the following I could not resolve
033 [ 1 ; 2 8 r 033 ( B 033 [ 4 l 033 [ ? 7
h 033 [ ? 1 2 l
Can someone shed some light on that?
In my attempts to find some lists of ANSI control codes I found a lot of pages, but obviously none complete. - Any hints on that?
(The problem is surely that there's so many terminal types, and that not
all are supported or standardized?)
On Fri, 24 Oct 2025 04:08:02 +0200, Janis Papanagnou wrote:
Incidentally I encountered some similar codes just recently and wondered
what they are doing; the following I could not resolve
033 [ 1 ; 2 8 r 033 ( B 033 [ 4 l 033 [ ? 7
h 033 [ ? 1 2 l
Can someone shed some light on that?
033[1;28r Set scroll region from line 1 to 28
033(B Select default character set (ASCII)
033[4l Disable underline mode
033[?7h Enable line wrapping
033[?12l Disable blinking cursor
I *think* these are correct.
In my attempts to find some lists of ANSI control codes I found a lot of
pages, but obviously none complete. - Any hints on that?
Everything I come across seems either incomplete or in some cases,
have differing meanings from one reference to another...
(The problem is surely that there's so many terminal types, and that not
all are supported or standardized?)
I think this too.
#!/bin/sh--
<<'NOTES'
pauses your script then continues on either a single key press or mouse click, works here with an xterm compatible terminal
Michael Sanders 2025
NOTES
pause() {
msg=${1:-"Press any key or click..."} # default message printf '%s'
"$msg"
old=$(stty -g)
printf '\033[?1000h'
stty raw -echo dd bs=1 count=1 < /dev/tty 2>/dev/null printf
'\033[?1000l'
stty "$old"
}
pause "Your script has finished"
# eof
033[1;28r Set scroll region from line 1 to 28
033(B Select default character set (ASCII)
033[4l Disable underline mode
033[?7h Enable line wrapping
033[?12l Disable blinking cursor
I *think* these are correct.
In my attempts to find some lists of ANSI control codes I found
a lot of pages, but obviously none complete. - Any hints on that?
(The problem is surely that there's so many terminal types, and
that not all are supported or standardized?)
<https://manpages.debian.org/console_codes(4)> covers just the Linux
text console, which is already pretty extensive; I think most if not all
the GUI terminal emulators implement supersets of that.
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
In my attempts to find some lists of ANSI control codes I found
a lot of pages, but obviously none complete. - Any hints on that?
(The problem is surely that there's so many terminal types, and
that not all are supported or standardized?)
I usually refer to this web page :
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 19:20:04 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
5 files (8,203K bytes) |
| Messages: | 184,913 |
| Posted today: | 1 |