首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >busybox安装脚本

busybox安装脚本
EN

Stack Overflow用户
提问于 2011-01-29 09:49:57
回答 1查看 5.5K关注 0票数 1

我相信这很简单,但我只是不知道该怎么做。

我有一个嵌入式系统上busybox的脚本,我想运行它,但我不知道如何运行脚本

我可以登录busybox并输入一些命令,但这是我知识的极限,我如何在桌面上执行.txt格式的脚本?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-01-29 10:36:19

我可以想到两种方式:

  • 无聊但更便携的那个:

代码语言:javascript
复制
1. Open the script file in an editor.
2. Log in to your embedded system and get to a busybox shell prompt.
3. Copy the first line of the script from the editor.
4. Paste it to the busybox prompt and press Enter, if necessary.
5. Copy the next script line from the editor
6. Paste it to the busybox prompt and press Enter, if necessary.
7. If there are any more lines, go back to step 5. If you encounter any errors, of course, you should stop and try to find out what's going on.
8. You will be tempted to just copy and paste the whole script in one go. _Don't!_ Depending of the TTY buffering behaviour on your embedded system, the results could be unexpected.

正确的方式:

代码语言:javascript
复制
1. Make sure that you have a writable filesystem for your script. Most embedded systems have at least a ramdisk that can be modified, although any changes are lost after rebooting. Once you find such a filesystem, `cd` into it if necessary.
2. Find a way to transfer the script file e.g. `script.txt` to your system. Depending on your embedded system, you could upload it using FTP, TFTP or SMB. If none of these is available, you can try using `cat` on busybox e.g. `$ cat > script.txt`, and copy/paste the script into the terminal - press `Ctrl + D` at the end of the file.
3. Run the script: `$ sh script.txt`
4. Alternatively to step `3`, use `chmod` to make the file executable: `$ chmod +x script.txt`. _Then_ you can run it: `$ ./script.txt`.

如果没有关于你的嵌入式设备和脚本的更多信息,我们不能真正帮助你更多。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4834607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档