what happens, when you write he command in ONE line. i guess the bash don't 
like the linefeed in the arguments.


--
Rene Groeschke

Email:  [email protected]
twitter: @breskeby
Blog:    http://www.breskeby.com

Am 02.07.2011 um 16:57 schrieb marcellodesales <[email protected]>:

> I'm trying to automate a server bootstrap for different users the following
> from a Gradle: 
> 
> The following command is executed by Root once the OS is installed and
> managed by each user: 
> 
> su - $username bash -c "svn checkout
> http://programming-artifacts.googlecode.com/svn/trunk/
> /workspaces/$username/pa" 
> 
> where $username is the user being setup... So if you try this in the shell,
> it executes as expected... I was trying to execute this command without
> "bash -c", but it will result in "cannot execute binary file"
> (http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2008-12/msg00221.html)...
> 
> /usr/bin/svn: /usr/bin/svn: cannot execute binary file
> 
> Here's now the gradle/groovy script using GString... I have also tried
> single quotes and the same problem happens...
> 
> ---------- setup.gradle --------- 
> 
> task checkout() << { 
> 
>   def username = "jsurfer" 
>   def checkout = """su - $username bash -c "svn checkout
> http://programming-artifacts.googlecode.com/svn/trunk/
> /workspaces/$username/pa"""" 
>   println "Checking out: $checkout" 
>   def proc = checkout.execute() 
> 
>   proc.waitFor() 
>   println "Output code ${proc.exitValue()}" 
>   println "stderr: ${proc.err.text}" 
>   println "stdout: ${proc.in.text}" 
> 
> } 
> ---------------------- 
> 
> Here's how I'm executing... 
> [root@localhost]# gradle -b setup.gradle checkout 
> 
> Here's the error 
> 
> Checking out: su - jsurfer bash -c "svn checkout
> http://programming-artifacts.googlecode.com/svn/trunk/
> /workspaces/jsurfer/pa" 
> Output code 2 
> stderr: bash: -c: line 0: unexpected EOF while looking for matching `"' 
> bash: -c: line 1: syntax error: unexpected end of file 
> 
> stdout: 
> 
> BUILD SUCCESSFUL 
> Total time: 1.355 secs 
> 
> Any clues? 
> thanks 
> Marcello
> 
> --
> View this message in context: 
> http://gradle.1045684.n5.nabble.com/su-USERNAME-bash-c-from-Gradle-Groovy-execute-results-in-error-bash-c-line-0-unexpected-EOF-while-lo-tp4544910p4544910.html
> Sent from the gradle-user mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to