Skip to main content

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Can you help me implement it here?

while :
do
    echo -e "\n Test script"
    echo -e "\t (0) Exit"
    echo -e "\t (1) Option 1"
    echo -n "Enter choice:"
      read main_menu
      case "$main_menu" in
         "0" ) exit
         ;;
         "1" ) exit
         ;;
esac
done

Thanks again!

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Can you help me implement it here?

while :
do
    echo -e "\n Test script"
    echo -e "\t (0) Exit"
    echo -e "\t (1) Option 1"
    echo -n "Enter choice:"
      read main_menu
      case "$main_menu" in
         "0" ) exit
         ;;
         "1" ) exit
         ;;
esac
done

Thanks again!

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Can you help me implement it here?

while :
do
    echo -e "\n Test script"
    echo -e "\t (0) Exit"
    echo -e "\t (1) Option 1"
    echo -n "Enter choice:"
      read main_menu
      case "$main_menu" in
         "0" ) exit
         ;;
         "1" ) exit
         ;;
esac
done
Post Closed as "Duplicate" by l0b0, cuonglm, Ramesh, Anthon, slm
added 373 characters in body
Source Link
Azalix
  • 13
  • 1
  • 4

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Can you help me implement it here?

while :
do
    echo -e "\n Test script"
    echo -e "\t (0) Exit"
    echo -e "\t (1) Option 1"
    echo -n "Enter choice:"
      read main_menu
      case "$main_menu" in
         "0" ) exit
         ;;
         "1" ) exit
         ;;
esac
done

Thanks again!

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Can you help me implement it here?

while :
do
    echo -e "\n Test script"
    echo -e "\t (0) Exit"
    echo -e "\t (1) Option 1"
    echo -n "Enter choice:"
      read main_menu
      case "$main_menu" in
         "0" ) exit
         ;;
         "1" ) exit
         ;;
esac
done

Thanks again!

Formatting
Source Link
Michael Homer
  • 78.9k
  • 17
  • 221
  • 239

I just started out with linux and bash script and hereHere is a portion of my scryptscript:

...

read main_menu

case "$main_menu" in

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

...

The question is how How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the enterEnter key? Practically, so practicallywhen you enter the number and it would directly jumpsjump to the next menu or function without the enter keyneeding to press Enter.

Thank you!

I just started out with linux and bash script and here is a portion of my scrypt:

...

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

...

The question is how can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the enter key, so practically you enter the number and it directly jumps to the next menu or function without the enter key press.

Thank you!

Here is a portion of my script:

read main_menu

case "$main_menu" in

    "0" )   exit
            ;;
    "1" )   cp /etc/bamt/cgminer.conf.X11 /etc/bamt/cgminer.conf;
            sudo mine restart;
            ;;

How can I make it so after the user enters 0 or 1, 2 etc, he doesn't have to press the Enter key? Practically, when you enter the number it would directly jump to the next menu or function without the needing to press Enter.

Source Link
Azalix
  • 13
  • 1
  • 4
Loading