Bash scripting
Code:
if [[ ! $DISPLAY && $(tty) = /dev/tty1 ]]; then |
What is the problem you are having (i.e., what errors are being thrown by BASH)? There is nothing that causes REPLY to change from the 'Y' or 'y' you provide when you answer the first question. So you'll never launch anything anyway. The real problem is all the ;; you have. Take a look at http://tldp.org/LDP/abs/html/abs-guide.html#CASEESAC1 You only need the ;; to terminate each block within the case construct, not a ;; at the end of each line.
|
Quote:
Code:
bash: /etc/bash.bashrc: line 33: syntax error near unexpected token `$REPLY' |
Okay, I got the ;; thing solved as you suggested and no errors are shown, but the problem you mentioned again happens, $REPLY is not flushed
Code:
if [[ ! $DISPLAY && $(tty) = /dev/tty1 ]]; then |
I love bash, I figured it out, this script works:
Code:
if [[ ! $DISPLAY && $(tty) = /dev/tty1 ]]; then |
You could go a little further to check your data being entered:
1. Your first questions allows the user to enter any number of key strokes but you only require 1 (read can limit this) 2. No need for multiple options of upper and lower case. Have bash force the answer to one or the other (, ,, ^ ^^ ... the options prior are clues) 3. What are my choices of Environment?? What if I say 'gnome' or Xfce4 or AwEsOmE ?? (silly some of these but I do not know your target audience) { you may even want to look at select so use can choose an option } 4. As part of 3, there is no catch all rule so as opposed to entering the wrong n or y, now nothing launches and there is no message to say why? Just some ideas. |
Quote:
|
All times are GMT -5. The time now is 07:41 PM. |