Shell Script Debug Print log issues

Source: Internet
Author: User
Shell Script Debug Print log issue 1. Demand

When we write scripts, sometimes we need to do debugging, so that we can locate the problem, and sometimes when the script goes online, we need to keep the records during the execution of the script. It makes it easier for us to locate problems when things go wrong.

2. Print script execution record to log file 2.1 script content as following script implementation

[Email protected]@@@]# VI cat_test.sh

#!/bin/bash

# # # #使用shell脚本的调试功能 to print the contents of the script execution to the log file

Set-x-V

EXEC 1>./test.log 2>&1

Who |wc–l

2.2 Log file contents

[Email protected]@@@]# cat Test.log

+ Who

+ wc-l

2

Shell Script Debug Print log issues

Related Article

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.