Tag Archives: NIX

Flash And Fade DEMO For Mac OSX 10.7.5, (And Linux?).

By wisecracker

This is an AT A GLANCE shell DEMO that does:-

1) 10 centred greyscale fades without warning beeps.

2) 5 centred yellow “WARNING!” flashes with beeps every ON state.

3) 5 FULL widowed red “DANGER!!!” flashes with beeps in the ON and OFF states.

It assumes that the warning bell is enabled inside the terminal.

It is primarily for OSX 10.7.5 and above but it could just as easily work in Linux or other UNIX like systems. It is issued as Public Domain and you my do with it as you please…

READ THE CODE FOR MORE INFO…

(Watch for wordwrapping, etc…)

Bazza, G0LCU…


#!/bin/bash
#
# Flash and fade for a Macbook Pro OSX 2.7.5 Terminal...
# A DEMO to show how to give an AT A GLANCE, and, audible warning of impending doom in a shell script.
# It is for something like an analogue Data Logger input say from an Arduino analogue source.
#
# It may well work on other Linux and Unix like machines but is untested and uses the "tput" command
# to hide and unhide the terminal cursor. The command "setterm" is commented out and could be used
# in place of the above depending on the *NIX flavour...
#
# Written in such a way that anyone can understand how it works.
#
# It starts with 10 cycles of grey/gray scale fading on a black background without any beeps then next
# 5 yellow warning flashes with a beep every full flash and finally 5 FULL screen red flashes with beeps
# on every ON and OFF state.
#
# Clear a screen to white on black...
printf "33[0;37;40m"
clear
printf "n Flash and fade for a default Macbook Pro OSX 2.7.5 Terminal.n"
# Turn the cursor off...
#setterm -cursor off
tput civis
# Fade on and off 10 times, grey/gray scales on black.
for fade in $(seq 1 10)
do
printf "33[12;23f33[1;30;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;90;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;37;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;97;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;37;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;90;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
done
# Over-write the above with the ...read more
Source: FULL ARTICLE at The UNIX and Linux Forums