bash 从 Eclipse 运行 shell 脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15085583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 04:40:35  来源:igfitidea点击:

run shell script from eclipse

eclipsebashshell

提问by alex440

I want to use Eclipse to run build scripts (on Ubuntu).

我想使用 Eclipse 来运行构建脚本(在 Ubuntu 上)。

I use make tool to do it like this:

我使用 make 工具这样做:

build_android:
chmod 755 "./build_android.sh"
./build_android.sh

I use make tool to launch scripts but I get "permission denied" on some strings, like

我使用 make 工具来启动脚本,但在某些字符串上出现“权限被拒绝”,例如

./build_android.sh: 19: function: Permission denied

on

NDK=/home/student/devtools/android-ndk-r8d
PLATFORM=$NDK/platforms/android-8/arch-arm
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86

function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
#and so on...
}

Why can it be and what solution is to launch scripts in Eclipse.

为什么会这样,什么解决方案是在 Eclipse 中启动脚本。

P.S. Why do I want it? I think it would be more productive to launch scripts in several clicks and also see the script output formatted in the console view of the environment.

PS 为什么我想要它?我认为通过几次点击启动脚本会更有效率,并且还可以在环境的控制台视图中查看格式化的脚本输出。

Thanks.

谢谢。

回答by adityalad

You can use the eclipse plugin: http://sourceforge.net/projects/shelled/

你可以使用eclipse插件:http: //sourceforge.net/projects/shelled/

回答by Armali

Probably Eclipse uses some other shell to execute the script, one that cannot define functions. Put a line #!/bin/bashat the top of the script.

Eclipse 可能使用其他一些 shell 来执行脚本,一个不能定义函数的 shell。#!/bin/bash在脚本顶部放置一行。