In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the method of implementing sh files by linux, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
Linux, there are two ways to use commands to execute .sh files:
1. Directly. / add the file name .sh. For example, run hello.sh as. / hello.sh [hello.sh must have x permission]
2. Add the file name .sh directly to sh. For example, run hello.sh as sh hello.sh [hello.sh may not have x permission]
Method 1: execute .sh files in the current directory
[step 1] cd to the directory where the .sh file is located
For example, take the hello.sh file as an example, as shown below
[step 2] add x execution permissions to the .sh file
For example, take the hello.sh file as an example, chmod uplix hello.sh, as shown in the following figure
[step 3]. / execute the .sh file
For example, take the hello.sh file as an example. / hello.sh can execute the hello.sh file, as shown in the following figure
[step 4] sh executes the .sh file
Take the hello.sh file as an example, sh hello.sh can execute the hello.sh file, as shown below
Method 2: execute .sh file by absolute path
The following three methods are fine, as shown in the following figure
. / home/test/shell/hello.sh/home/test/shell/hello.shsh / home/test/shell/hello.sh
Note: when executing with ". /" plus the file name .sh, you must add x execution permission to the .sh file.
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the methods and contents of linux's implementation of sh files. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.