shell Command execution Failing when executed from Java

后端 未结 1 464
借酒劲吻你
借酒劲吻你 2021-01-27 06:47

When I execute the below command on command line, it shows all the stored procedures and tables in the sybase DB.

printf \'sp_help\\ngo\\n\' | isql -Uxx -Pxxxx -         


        
相关标签:
1条回答
  • 2021-01-27 07:05

    Several things come to mind:

    • Incomplete PATH environment variable (thus isql can't be found).
    • If it's a command you provide, instead of messing with PATH you might want to make sure your are you in the correct working directory and call ./isql instead.
    • Since you're using a pipe, you should let a shell execute this as in sh -c "foo | bar". Otherwise the | isql ... part is passed as argument to printf as well.
    0 讨论(0)
提交回复
热议问题