Menu sem er kominn :
Kóði: Velja allt
#!/bin/sh
echo "
### Veldu annaðhvort a - b - c - d - e ###
• A. Provide a shell prompt
• B. Print help
• C. Output an HTML version
• D. Output a text version
• E. Exit
"
read answer
case $answer in
a|A) echo Þú valdir a;;
b|B) echo Þú valdir b;;
c|C) echo Þú valdir c;;
d|D) echo Þú valdir d;;
e|E) echo Þú valdir e;;
*) echo Þú valdir ekki a, b ,d or c;;
esac
Uppskrift/leiðbeiningar um svona klukku sem ég fann á netinu :
http://bashscript.blogspot.com/2010/04/ ... -date.html
Kóði: Velja allt
#!/bin/bash
# SCRIPT: digclock.sh
# USAGE: ./digiclock &
# PURPOSE: Displays time and date in the top right corner of the
# screen using ANSI escape sequences.
# To stop this digclock use command kill pid.
################################################################
#################### VARIABLE DECLARATION ######################
# To place the clock on the appropriate column, subtract the
# length of $Time and $Date, which is 22, from the total number
# of columns
Columns=$(tput cols)
Startpoint=$(($Columns-22))
# If you're in an X Window System terminal,you can resize the
# window, and the clock will adjust its position because it is
# displayed at the last column minus 22 characters.
########################### MAIN PROGRAM #######################
# The script is executed inside a while without conditions.
while :
do
Time=`date +%r`
Date=`date +"%d-%m-%Y"`
echo -en "\033[s" #save current screen position & attributes
tput cup 0 $Startpoint
# You can also use bellow one liner.
# tput cup 0 $((`tput cols`-22))
# But it is not efficient to calculate cursor position for each
# iteration. That's why I placed variable assignment before
# beginning of the loop
# print time and date in the top right corner of the screen
echo -en "\033[42m$Time \033[46m$Date\033[0m"
#restore current screen position & attributes
echo -e -n "\033[u"
#Delay for 1 second
sleep 1
done
Það sem vandamálið felst í er að ég veit ekki hvernig ég get komið þessum menu til að virka og vera með þessari klukku.
Langar að nota þessa klukku því hún lýtur vel út , en ég get líka notað "date" en hvernig breyti ég staðsetningum á hlutum í shell scriptum ?
MBK
Bjarni