Problems encountered during use of linux Pipelines

Source: Internet
Author: User

Problems encountered during use of linux Pipelines
This is the first time I have published a blog on ChinaUnix. I hope you can share more with me in the future!
Go to the topic:
Today, I encountered a pitfall:
Call the conf_del method in the server_function file in the script to delete the configuration file.
Then, in the directory where the script is deleted
The conf_del method is as follows:
Function conf_del {
Cnt_EV = 'grep "export EVSERVER_RUNTIME" $1 | wc-l'
Cnt_QT = 'grep "export QT_PLUGIN_PATH" $1 | wc-l'
Cnt_Flum = 'grep "export FLUME_HOME" $1 | wc-l'
[[$ Cnt_EV-eq 1] & sed-I "/export EVSERVER_RUNTIME/d" $1
[[$ Cnt_QT-eq 1] & sed-I "/export QT_PLUGIN_PATH/d" $1
[[$ Cnt_Flum-eq 1] & sed-I "/export FLUME_HOME/d" $1
}
To put it bluntly, some information in the. bashrc file is deleted.
Because I tested other functions today, the deletion information in the. bashrc file does not exist.

Therefore:
[[$ Cnt_EV-eq 1] & sed-I "/export EVSERVER_RUNTIME/d" $1
[[$ Cnt_QT-eq 1] & sed-I "/export QT_PLUGIN_PATH/d" $1
[[$ Cnt_Flum-eq 1] & sed-I "/export FLUME_HOME/d" $1
This place has a cup.
The script returns only:
[[0-eq 1]
[[0-eq 1]
[[0-eq 1]
Then, the operation to delete the directory where the script is located is no longer performed.

After checking and testing, we found that the problem should be caused by the Linux pipeline.
The conf_del method cannot be exited because [[0-eq 1]

Solution: append a sentence in the conf_del method.
Function conf_del {
Cnt_EV = 'grep "export EVSERVER_RUNTIME" $1 | wc-l'
Cnt_QT = 'grep "export QT_PLUGIN_PATH" $1 | wc-l'
Cnt_Flum = 'grep "export FLUME_HOME" $1 | wc-l'
[[$ Cnt_EV-eq 1] & sed-I "/export EVSERVER_RUNTIME/d" $1
[[$ Cnt_QT-eq 1] & sed-I "/export QT_PLUGIN_PATH/d" $1
[[$ Cnt_Flum-eq 1] & sed-I "/export FLUME_HOME/d" $1
Echo "all informations have been deleted! "
}
Then, the steps for deleting directories in the main script can be continued.

Note: I do not quite understand why this problem occurs. I hope you will have a chat with me. Thank you!

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.