Align Menu script
I am creating a script that creates a Menu to go true.
I have done the following Code:
seq -s ""#"" 70 | sed 's/[0-9]//g' Can someone help me with my problem |
Personally I wouldn't give a rats ass for eye-pleasing menus and simply use whatever BASH "select" prints to get the job done (unless your job is to look at preeeetty, preeeeeetty menus, that is ;-p). If you don't want use a CLI tool like 'dialog' (ncurses) then you'll probably want to use 'tput' as in http://wiki.bash-hackers.org/scripting/terminalcodes / http://tldp.org/LDP/abs/html/colorizing.html.
|
1) Please specify the shell language you're using.
2) Effective use of whitespace, indenting, and comments help to make a script readable and more easily debuggable. Huge, unbroken blocks of commands are hard to decipher. 3) Try storing the raw text in variables, rather than echoing the strings directly. Then you can use the shell's built-in string manipulation features to handle some of the text work. 4) Assuming bash or another shell that supports it, you can also probably use the printf command to control formatting, rather than external tools like sed. 5) Heck, why try to dynamically format it at all? Why not just build a static, or at least mostly static, menu? The less you can rely on external tools, the more efficient the script will be. You can store the pre-formatted menu in a here document, and put it in a function to print it on demand. Another option could be to store it in an array with one line per element. 6) You might consider using dialog instead. Why reinvent the wheel when there are already tools designed to do this for you? |
It was a strugle and had help from your tips.
I have solved my problem. Thank you. |
All times are GMT -5. The time now is 08:33 PM. |