Write batch processing in linux for the first time

Source: Internet
Author: User
For the first time, write batch processing in linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. Due to the needs of project testing, I used a virtual machine to build a weblogic testing service in my own book. Then I encountered a problem. Every time I typed a bunch of cd commands in the terminal to find the directory, it was very complicated. So I wanted to write a batch to start the service. I used to write batch processing in windows, but I couldn't even perform basic operations on linux, let alone write batch processing. After half an hour of searching materials and experiments, the final batch processing is still available.

My operating system is suse 10. weblogic is installed in the root directory, and the instance directory is/domains/ctcpstest7001. I created a text file and opened it with gedit. Write the following code:

Cd bea/user_projects/domains/ctcpstest7001;
./StartWebLogic. sh

Save the edited file, but the file is not yet an executable file. If you want to execute it on the terminal, right-click the file and choose Properties> permission tab, select the "execute" check box and disable it. Double-click the file, and the system will prompt you to select the running mode. Then you can choose to run it on the terminal. The prompt information of different operating systems should be different.

It took me half an hour to process two lines of batch processing, but I was not aware of the following problems:

1. When creating a batch file in suse, unlike windows, you can create a bat file directly. In linux, you can only create a document file, and then enable the execution permission in the permission. This is a confusing place for me.

2. The directory name is also confusing to me. I started to write cd/bea /......, The execution said that the directory could not be found and then changed to cd bea /...... You can. Note that there is no backslash before the bea directory.

There is still a problem with the script. This batch file can only be run on the desktop, that is, the directory in the script is fixed. I want to use batch processing to read the weblogic installation directory and replace it with variables. But in view of my current level, let's talk about it later.
Although the script is simple, it is a milestone for me, a bit similar to the first Hello world in the JAVA program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.