Hallo,

 
> > array=`cat targets.conf`
> array=( `cat targets.conf` )
> 
> Dein $array ist gar kein Array.

OK.

> > for item in $arr...@]
> for item in ${arr...@]}
> 
> > selection=$array[$(cat /tmp/menu)]
> selection=${array[$(cat /tmp/menu)]}

Verbesserte Version :

<-- Code

#!/bin/sh

array=( `cat targets.conf` )
n=0
for item in ${arr...@]}
do
menuitems="$menuitems $n ${item}"
let "n = $n + 1"
done

dialog --title "Ziel auswaehlen" --menu \
"Waehlen Sie ein Ziel oder Abbrechen" \
14 40 6 $menuitems 2> /tmp/menu
if [ $? -gt 0 ]; then
rm -f /tmp/menu
clear
echo "Abgebrochen"
exit 0
fi
selection=${array[$(cat /tmp/menu)]}
echo "Ausgewaehlt $selection"

--> Code

Das endet allerdings in ./menu.sh: 3: Syntax error: "(" unexpected

Ich find den Fehler einfach nicht.

Ralph
--
Linux mailing list [email protected]
subscribe/unsubscribe: http://lug-owl.de/mailman/listinfo/linux
Hinweise zur Nutzung: http://www.lug-owl.de/Mailingliste/hints.epo

Antwort per Email an