在shell脚本linux中执行程序

时间:2021-07-03 17:29:34

I have a program which im trying to execute through shell script

我有一个程序,我试图通过shell脚本执行

This is the command to execute the program /data/local/tmp/dbus/dbus-run-session --dbus-daemon=/data/local/tmp/dbus/dbus-daemon --config-file=/data/local/tmp/dbus/session.conf sh if i run the program directly without shell script this works fine

这是执行程序/ data / local / tmp / dbus / dbus-run-session的命令--dbus-daemon = / data / local / tmp / dbus / dbus-daemon --config-file = / data / local /tmp/dbus/session.conf如果我直接运行程序没有shell脚本,这很好

But when i put this same command in a shell script and run the shell script i get the following error

但是,当我将相同的命令放在shell脚本中并运行shell脚本时,我得到以下错误

Permission deniediled to exec 'sh

执行被拒绝执行'sh

if i remove the sh from the end of the command i get the error that a non-option argument is required.

如果我从命令的末尾删除sh我得到错误,需要一个非选项参数。

its not a chmod +x issue since the script is running and i have done the chmod already

它不是一个chmod + x问题,因为脚本正在运行,我已经完成了chmod

PS. I'm running this shell script on the android terminal

PS。我在android终端上运行这个shell脚本

does anyone know how to fix this issue?

有谁知道如何解决这个问题?

1 个解决方案

#1


-2  

You likely need to use chmod +x <yourscript.sh> This should give the script permission to run!

您可能需要使用chmod + x 这应该赋予脚本运行权限!

#1


-2  

You likely need to use chmod +x <yourscript.sh> This should give the script permission to run!

您可能需要使用chmod + x 这应该赋予脚本运行权限!