简体   繁体   English

如何编写一个 shell 脚本文件可以在 Linux 中运行脚本

[英]How to write a shell script file that can run a script in Linux

I am trying to make a.sh file that when clicked it runs the script inside.我正在尝试制作一个 .sh 文件,单击该文件时它会在其中运行脚本。 I am trying to recursively find a certain string value inside the contents of the files from a given folder, using $ grep -r "word" /home/folder_name but I don't know how to do so without running the script in terminal.我正在尝试使用$ grep -r "word" /home/folder_name在给定文件夹的文件内容中递归地查找某个字符串值,但我不知道如何在不运行终端脚本的情况下这样做。

Any ideas for this?对此有什么想法吗?

Linux shell scripts can be written very basically.To make a shell script, start the script with #!/bin/sh and add normal linux commands. Linux shell scripts can be written very basically.To make a shell script, start the script with #!/bin/sh and add normal linux commands. That is a simple explanation, but it is sufficient for most simple scenarios.这是一个简单的解释,但对于大多数简单的场景来说已经足够了。

Example:例子:

#,/bin/sh echo "Hello, World!`

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

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