![]() |
Bash script configurable selection box
2 Attachment(s)
I've created a small utility under Mono framework which is very useful for me and I thought someone else might find it useful.
It allows you to launch a dialog from bash scripts which shows a selection list of items. When you click on one of the items, you get a return value with the number of the item in the list. The return value can be inspected in your script, and the operations relevant for this item can be executed. The title of the dialog and the list items' text is very easily configured by the command line parameters. The number of items in the list is determined by the number of parameters being sent - for example, the following command: mono ./DynamicSelection.exe Activate_Car_Mode? Yes With_Media_Player No Will launch the dialog shown below. The return value from this dialog can be 1, 2 or 3: 1 - "Yes" pressed 2 - "With Media Player" pressed 3 - "No" pressed A typical bash script can be: val=$(mono ./DynamicSelection.exe Activate_Car_Mode? Yes With_Media_Player No) if [ $val = 1 ]; then # activate car mode commands elif [ $val = 2 ]; then # activate car mode with media player commands elif [ $val = 3 ]; then # do nothing fi I'm using it to launch automatically different dialogs for various events - like when I enter my car, going to sleep, for gaming console mode (when TV is connected), when I'm back home etc. I believe it can be helpful for those who write bash scripts, but have no development knowledge. It requires the Mono framework to be installed and having execute permissions of course. |
All times are GMT. The time now is 17:59. |
vBulletin® Version 3.8.8