aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/screenwatch
blob: d556fac8395a1e4bedfe8d631c9031f0d5f027f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
# repeatedly open terminal at $dev, even when $dev temporarily dissapears
dev="$1"
while inotifywait -qq -e create --include "$dev" "$(dirname "$dev")"; do
	sleep 0.1 # wait until device is initialized
	screen "$@"

	# break out of loop if device still exists when screen exits (manual screen exit)
	[ -e "$dev" ] && break
done