简体   繁体   English

使用终端模拟器在Android中编写脚本

[英]Scripting in Android with terminal emulator

I was a beginner in Linux. 我是Linux的初学者。 And I had no Computer when I wrote this. 当我写这篇文章时,我没有电脑。 I used terminal emulator on my Android to run Linux commands. 我在Android上使用终端模拟器来运行Linux命令。 I installed Busybox too. 我也安装了Busybox。 I also had root access.I tried to execute a shell script "sample.sh". 我也具有root用户访问权限。我尝试执行shell脚本“ sample.sh”。 The terminal opens but the file was not executed. 终端打开,但文件未执行。 So I asked "What is the .bat equivalent extension in linux?". 所以我问“ Linux中.bat等效扩展名是什么?”。

Is this really a very bad question? 这真的是一个非常糟糕的问题吗? What was the point in downvoting the question here? 在这里否决这个问题有什么意义? I clearly mentioned what I have tried and What happended. 我清楚地提到了我尝试过的事情和发生的事情。 And that genuine downvoter never explained the reason. 那个真正的低俗主义者从来没有解释原因。 Is this the correct way to treat a newbie. 这是对待新手的正确方法吗? With lots of hatred from my various questions, I lost hope and never used SO 带着对各种问题的仇恨,我失去了希望,从未使用过SO

So if there is still hope. 所以如果仍然有希望。 Can anyone justify the actions? 任何人都可以为这些行动辩护吗?

The equivalent extension is .sh , but you also need the correct shebang line. 等效扩展名为.sh ,但您还需要正确的shebang行。 The first line of a unix script is examined to determine the magic number - you want something like 检查unix脚本的第一行以确定幻数 -您需要类似

#! /usr/bin/env bash

And the file needs to have the executable bit set, 文件需要设置可执行位,

chmod a+x file.sh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM