How do I get Hudson to stop slipping parts of my shell script?

I would like to have a shell script that copies some logs from part of my system into the hudson workspace so that I can archive them.

So now I have

#!/bin/bash -ex
cp /directory/structure/*.log .

It's kind enough to be able to change to

cp '/directory/structure/*.log' .

Which, of course, was not found, since I do not have a file named * .log.

So how do I get this script to work?

EDIT Therefore, I left the part that sudo cp / path / *. Log used because I did not think it mattered. Of course it is, and sudo is not a hudson problem.

+3
source share
3 answers
sudo bash -c "cp /directory/structure/*.log"
+1
source

- script hudson this.

+1

Throwing him there, but he did not have the opportunity to try it in Hadzon (so I don’t know how he is quoted):

for f in /directory/structure/*.log ; do
    cp $f .
done

In my simple test in the bash shell, different variants of quotation marks cause one or more calls to the copy command (either with all the corresponding files, or one at a time), but all of them successfully execute the copy.

0
source

Source: https://habr.com/ru/post/1742172/


All Articles