command line build shell scripts

hi,

i want to run a small shell script which goes through some folders and executes a command in that folder

this works when i execute it on the server by (unix bash)shell:

for f in $(ls /myfolder/ );do
     command $f
done

this is the error message I get:
custom_script229402634541056275: syntax error at line 1: `$' unexpected

I also tryed to put the code in an external file and run that but it didnt help.

Is and if so who is it possible to run somthing like that?

Grues + merci
filliale

4 comments
Comment actions Permalink

Try to add "#!/bin/sh" as script first line. (or "#!/bin/bash")

Could you please also say your SHELL variable.

1
Comment actions Permalink

Hi,

It looks very strange.
I have tryed to reproduce this on Linux agent, but this script works.

Command line runner runs default SHELL for scripts. With bash all ok.

Could you please show build log?

0
Comment actions Permalink

hi Vladislav,

thanks for looking into this :-)

this would be my log:

[17:54:07]: Skip checking for changes - changes are already collected
[17:54:08]: Clearing temporary directory: /.../TeamCity/buildagent_3/temp/buildTmp
[17:54:08]: Checkout directory: /.../TeamCity/CheckoutDir/app/trunk/0_incremental_build/checkout
[17:54:08]: Updating sources: server side checkout... (2s)
[17:54:08]: [Updating sources: server side checkout...] Building incremental patch for VCS root: hecr_app_trunk
[17:54:11]: [Updating sources: server side checkout...] Repository sources transferred: 47.41Kb total
[17:54:11]: [Updating sources: server side checkout...] Updating /.../TeamCity/CheckoutDir/app/trunk/0_incremental_build/checkout
[17:54:11]: Publishing internal artifacts (1s)
[17:54:12]: [Publishing internal artifacts] Sending build.start.properties file
[17:54:12]: Starting: /.../TeamCity/buildagent_3/temp/agentTmp/custom_script5989638145761711254
[17:54:12]: in directory: /.../TeamCity/CheckoutDir/app/trunk/0_incremental_build/checkout
[17:54:12]: /.../coherenceTest/TeamCity/buildagent_3/temp/agentTmp/custom_script5989638145761711254: syntax error at line 2: `$' unexpected
[17:54:12]: Process exited with code 2
[17:54:13]: Publishing internal artifacts (3s)
[17:54:16]: [Publishing internal artifacts] Sending build.finish.properties file
[17:54:16]: Build finished

i also tryed it with the normal shell and it did work :-)
or instead do you have a better idea to do this?

grues
0
Comment actions Permalink

hey it worked!! thank very much!

strangely when i put the whole script in an executable file and called that one i had this line in the file but that did not work!

cool thanks a lot again! :-)

0

Please sign in to leave a comment.