Linux / UNIX Tech Support Forum
This is a discussion on Shell script read in indented / menus within the Shell scripting forums, part of the Development/Scripting category; Dear All I am writing a simple shell script of menu options. Here is an extract: echo " Press 1-5 ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Dear All
I am writing a simple shell script of menu options. Here is an extract: echo " Press 1-5 or 9, then press Enter [ ]" echo "" read i What I would like to do is arrange for the cursor to be after the word Enter ans between the [ and ]. Is this possible? Thanks and wait to hear Stephanos |
| Sponsored Links | ||
|
|
|
||||
|
Noop. Shell lacks cursor movement, try something as follows:
Code:
read -p "Press 1-5 or 9, then press Enter : " i Code:
dialog --menu "Select choice" 15 30 3 1 Choice1 2 Choice2 3 Choice3 4 Choice4 5 Choice5 6 Exit Code:
#!/bin/bash
ansfile=/tmp/file.$$
height=15
width=40
menu_height=5
title="Main Menu"
dialog --clear \
--title "$title" \
--menu "Select choice" $height $width $menu_height \
1 "Choice1" \
2 "Choice2" \
3 "Choice3" \
4 "Choice4" \
5 "Choice5" 2>$ansfile
ret=$?
ans=$(cat $ansfile)
case $ret in
0)
echo "You selected $ans";;
1)
echo "[Cancel] key pressed.";;
255)
echo "[ESC] key pressed.";;
esac
/bin/rm -f $ansfile
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| dialog , shell script menu , shell script to display dialog boxes , shell scripting |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FTP SHELL Script | gsb1bee | Shell scripting | 3 | 24-04-2009 05:32 PM |
| Script to open and read a file that is supplied as a command line arg | blingbling | Shell scripting | 3 | 31-03-2009 10:54 AM |
| shell script for ftp | chaharvikram | Shell scripting | 0 | 09-10-2008 06:24 PM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 29-07-2008 10:22 AM |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 08-10-2007 12:36 AM |