[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] En 'for' lykke i konsolen



Kim Hansen wrote:

> Jan Trøjgaard <sslug@sslug> writes:
> 
>>>> > Lykken(erne) jeg skriver ser sådan ud:
>>>> > sslug@sslug:~$ for freq in $((seq 200 20 2000)): beep -f $freq: done
>>>> 
>>>> bash her.
>>> 
>>> men det virker sådan her:
>>> for freq in `seq 200 20 200`; do beep -f $freq; done
>>
>> Den giver kune ét beep på frekvensen 200 hertz! Men den siger noget.
>> Jeg har også lige prøvet med et par andre variationer:
>> sslug@sslug:~$ for freq in $((`seq 200 20 200`)); do beep -f $freq; done
>> sslug@sslug:~$ for freq in $((seq 200 20 200)); do beep -f $freq; done
>> bash: seq 200 20 200: syntax error in expression (error token is "200 20
>> 200")
>> sslug@sslug:~$ for freq in $((`seq 200 20 200`)); do beep -f $freq; done
>> sslug@sslug:~$ for freq i in $((`seq 200 20 200`)); do beep -f $freq; done
>> bash: syntax error near unexpected token `i'
>> sslug@sslug:~$ for i freq in $((`seq 200 20 200`)); do beep -f $freq; done
>> bash: syntax error near unexpected token `freq'
> 
> I bash betyder `command` og $(command) det samme, udfør command og sæt
> uddata ind i den kommandolinje der er ved at blive bygget op.
> 
> For at lege lidt med det kan du prøve kommandoerne:
> seq 200 20 200
> seq 200 20 240
> seq 200 20 2000
> echo $(seq 200 20 240)
> for freq in $(seq 200 20 200); do beep -f $freq; done
> for freq in $(seq 200 20 240); do beep -f $freq; done
> for freq in $(seq 200 20 2000); do beep -f $freq; done
> 
>>Så lykkedes det. Mange tak for hjælpen.
>>Det var så den måde jeg skrev kommandoen der var noget i vejen med.

Jeg havde jo glemt 'do'

Med venlig hilsen
Jan Trøjgaard


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *