[Linux-Biella] Problema con dialog
Federico Pistono
fppain a gmail.com
Gio 4 Maggio 2006 18:32:27 CEST
Ciao a tutti,
scriptino in bash, semplifico per rendere l'idea dolo della parte che
non funziona.
#!/bin/bash
function ciao(){
sedda "__lhas iuaGGGGGGGGG__" "__AAAAAAAAAAAa__"
"__VVVVVVVVVVVV__" "__CCCCCCCCC__"
}
function sedda(){
echo -e $@ | sed -e 's/__/\"/g'
}
ciao
exit 0
$ ./b
"lhas iuaGGGGGGGGG" "AAAAAAAAAAAa" "VVVVVVVVVVVV" "CCCCCCCCC"
OK, come dovrebbe. A proposito, ho usato il valore sentinella __ se
avete inmente soluzione piu' intelligente ben accetta.
#!/bin/bash
PGM=`basename $0`
VERSION="0.3"
AUTOR="Me"
DATE="Today"
function window_menu(){
WHAT=`echo -e $@ | sed -e 's/__/\"/g'`
echo $WHAT # controllo, funziona
dialog --backtitle "$PGM v$VERSION - $AUTOR $DATE " --title "Menu"
--menu "$1" 0 0 0 $WHAT 2>/tmp/menu.$$
# RIS=`cat /tmp/menu.$$`
# rm -f /tmp/menu.$$
# clear
}
function begin() {
window_menu "__1__" "__Choose one of the following options__"
"__2__" "__Manage disc space__" "__3__" "__Remove games files from the
disk__" "__4__" "__Search for users__" "__5__" "__Exit program__"
# MENUITEM=$RIS
# case $MENUITEM in
# 1) echo "space"; wait;;
# 2) echo "games"; wait;;
# 3) echo "search"; wait;;
# 4) exit 0;;
# esac
}
##############################################
# Let's call these functions, the main program
##############################################
#while :
#do
begin
#done
exit 0
Se gli passo la stringa a mano funziona, $WHAT e' esattamente quella,
ma con la variabile non va. E' un errore logico/sintattico, nel senso
che non riesce ad interpretare correttamente?
Ho provato anche a dare
dialog --backtitle "$PGM v$VERSION - $AUTOR $DATE " --title "Menu"
--menu "$1" 0 0 0 `echo -e $@ | sed -e 's/__/\"/g'` 2>/tmp/menu.$$
prima di ricorrere alla varibile, ma nulla.
????
--
Federico Pistono Department of Computer Science - Verona, Italy
http://www.federicopistono.org :: http://pain.altervista.org/flatnukeuwcad/
http://pain.altervista.org :: Linux Registered User #340392
"Just remember....you were a n00b yourself once..."
"Speak for yourself. After my mother re-partitioned her drive and
mounted the smaller one at "/womb" I was compiled from source."
Maggiori informazioni sulla lista
Linux