[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



Jan Trøjgaard wrote:
Kim Schulz wrote:


On Thu, 25 May 2006 13:47:49 +0200
Kim Schulz <sslug@sslug> wrote:


On Thu, 25 May 2006 13:37:59 +0200
Jan Trøjgaard <sslug@sslug> wrote:


Jeg var til foredrag den 18 og det var ganske fortræffeligt. Der
blev også vist en 'for' lykke, hvor beep var det program der blev
kaldt, men nu sidder jeg herhjemme og kan ikke få lykken til at
virke, jeg spurgte også lige ude på CBC i går, onsdag, o gfik lidt
svar, uden at jeg har haft held med mig her hjemme.

Lykken(erne) jeg skriver ser sådan ud:
sslug@sslug:~$ for freq in $((seq 200 20 2000)): beep -f $freq: done

erstat : (kolon) med ; (semi kolon) og smid do efter det først ;

altså

for freq in ...; do beep -f $freq; done

jeg er dog ikke sikker på din seq ting. den virker umiddelbart ikke i
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'

Men den vil stadig ikke udføre sekvensen i løkken!

Med venlig hilsen
Jan Trøjgaard



seq 200 20 200 er ikke nogen sekvens

Fra 200 til 200 giver kun 1 output, så det er ikke så mærkeligt.

PEA




 
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] *