groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sverre Moe <>
Subject Problem running find execute has error
Date Tue, 11 Jun 2019 18:05:07 GMT
Groovy is doing something strange with my execute command.
Or perhaps something wrong with my code I cannot see.

vim find.groovy
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = "find RPMS -regex '.*/package-name-[0-9.]+-.\\.x86_64\\.rpm'
-exec cp -v {} . \\;".execute()
proc.consumeProcessOutput(sout, serr)
println "out> $sout"
println "err> $serr"

Create the directory and files for testing the find.groovy
mkdir RPMS
touch RPMS/package-name-1.0.0-1.x86_64.rpm
touch RPMS/package-name-devel-1.0.0-1.noarch.rpm

The output from running the find.groovy seems to suggest the find command
is wrong.
groovy find.groovy
err> find: argument for «-exec» is missing

But running it in bash works just fine:
find RPMS -regex '.*/package-name-[0-9.]+-.\.x86_64\.rpm' -exec cp -v {} .
'RPMS/package-name-1.0.0-1.x86_64.rpm' ->

I can reproduce the error in Bash with an additional slash at the end.
find RPMS -regex '.*/package-name-[0-9.]+-.\.x86_64\.rpm' -exec cp -v {} .
find: argument for «-exec» is missing


View raw message