← Back to team overview

sikuli-driver team mailing list archive

[Question #691987]: Problem to execute a shell command with run()

 

New question #691987 on Sikuli:
https://answers.launchpad.net/sikuli/+question/691987

Hello,  
The concerned command is a bit particular as it's defined like below where I pipe answers to a script:  

    sh -c 'cd /home/my/path && printf "1\ny\ny\ny\ny\ny\n" | ./scripts/prepare_VM_data.sh'

This command perfectly works in bash but I want to execute it from Sikulix script (jython).

My code is:  

    cmd = "sh -c 'cd /home/my/path; printf \"1\ny\ny\ny\ny\ny\n\" | ./scripts/prepare_VM_data.sh'"
    print cmd
    print run(cmd)

The output in Sikulix IDE's console is:  

    sh -c 'cd /home/my/path; printf "1
    y
    y
    y
    y
    y
    " | ./scripts/prepare_VM_data.sh'
    1
    *****error*****
    /home/my/path;: -c: line 0: unexpected EOF while looking for matching `''
    /home/my/path;: -c: line 1: syntax error: unexpected end of file

I don't really understand the error and who complains about the bad syntax.

Regards,

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.