#!/bin/bash #.Y / 70 83 / / / / 105 / / / / / / ;A4_QUER.Y #.YT 3 2 0 0 3 3 1 / / / #.H!a!0:linux//io/con_/THIS!0.!c # # copyright : (C) 2009 by Thomas Bruecker =: tbrue # email : public0x05bf@bluewin.ch # # tbrue 03dec2007, 27aug2011 # # con_ THIS : console-functions # +++++++++++++++++++++++++++++ # # MyHash("linux//io/con_/THIS") = 0x0A1D # # * for every function: # * if returned result is not commented, the function returns 0 on no-error. SCRIPTS=root/bin con_CLEAR() # * clear console. { /usr/bin/clear return # /usr/bin/clear returns 0 . } con_CursorSet() # * set cursor position. # * upper left corner: (x, y) = (0, 0) . # $1 : x = horizontal_position, # $2 : y = vertical_position . { /usr/bin/tput cup $2 $1 return # /usr/bin/tput returns 0 . } con_READ() # $1: prompt. # $2: options as "-s", ...; see bash. # reads a password and prints it to stdout. { local Input0x0A1D if [ -z "$2" ]; then read -p "$1 " Input0x0A1D else read "$2" -p "$1 " Input0x0A1D fi echo >&2 # after entering the input, # we want a new line. echo -n "$Input0x0A1D" # "-n" : no newline ! return 0 } con_YesQ() # Yes? # * after the prompt you may enter "yes" or "no". # * returns "0" if "yes" is entered; else returns "1". { while read -p " yes | no> "; [ "no" != "$REPLY" -a "yes" != "$REPLY" ] do echo "Enter only \"yes\" or \"no\"!" done [ "yes" = "$REPLY" ] return # result of above test. }