BASH Shell debugging

Source: Internet
Author: User
Bash -- DebuggerScript Script-arguments...
 

Having used to VIM, writing BASH Shell also uses it. Generally, shell is short, so there is no way to improve efficiency, today, I accidentally saw someone mention a bash support plug-in for compiling bash in Vim. I just downloaded it and tried it. It's really powerful.

After the download, follow the instructions to install gvim test. sh opens and you will see the powerful functions in the bash menu. Although most of them are not used, at least I cannot use them. Some syntaxes have not been seen yet, but they can be used as reference manuals ....

Next, we need to debug the function. We need to install bashdb and sudo apt-Get install bashdb. After installation, follow the instructions on the Internet, by default, the bash support plug-in's debugging path is different from the bashdb installation directory. just create a link.

Sai @ Sai-LAPTOP :~ $ Whereis bashdb
Bashdb:/usr/bin/bashdb/usr/share/man/Man1/bashdb.1.gz

Sai @ Sai-LAPTOP :~ $ Sudo mkdir/usr/local/share/bashdb

Sai @ Sai-LAPTOP :~ $ Sudo ln-S/usr/share/bashdb/bashdb-main.inc/usr/local/share/bashdb/bashdb-main.inc

Then OK. Write a shell and start debugging on F9.

Common debugging methods

Run

R restart

W. View nearbyCode

. List currently running code

L m n list the code between M and N rows

B n sets a breakpoint on the nth line

L list all breakpoints

D N deletes the breakpoint of row n

D. Delete all breakpoints.

W var observe VaR

N single-step execution

S one-step execution to enter the Function

P $ var: displays var. It is the most commonly used command.

T observation Stack

Skip skips the command to be executed

After RET is executed, the function returns

FinishProgramEnd

A n cmd executes the CMD command in line N.

A. Cancel all added actions.

Q exit debugging

Detailed bashdb documentation (English)

 

Http://bashdb.sourceforge.net/bashdb.html#Invocation

Http://lug.fh-swf.de/vim/

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.