[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash-Scripting



Am Donnerstag, 1. Januar 2004 22:11 schrieb Michelle Konzack:
> ich versuche gerade folgendes:
>
> eine Datei:
>
> # album.alb
> T1=text1
> T2=text2
> T3=text3
>
> ein Script:
> #!/bin/bash
> source album_001.alb
> count=0
> while [ $count -lt 17 ] ; do
>     let count=count+1
>     SONG=T$count
>     echo $SONG
> done

Ich weiss zwar nicht, was Du als Ergebnis haben willst (Du verrätst 
es uns ja nicht ;), vermute aber mal, dass in $SONG text1, text2 
usw. stehen soll.

> Also die Schleife funktioniert... - Nur nicht die Zeile
> "SONG=T$count" Die BASH sagt mir jedesmal:
>
> ./script: =T1: command not found
>
> Also ich gehe mal davon aus, das $count von einem arithmetischen
> Wert in eine Zeichenkette umgewandelt werden muß. (richtig ?)

Nö.

<schnipp>
#! /bin/bash
. album.alb
for i in `seq 0 16`; do
  SONG=`eval echo '$T'$i`
  echo $SONG
done
<schnapp>

Jan



Reply to: