小编Pat*_*tin的帖子

gdb 挂在“退出()”上

当我想关闭时gdb,我经常打错字

quit()
Run Code Online (Sandbox Code Playgroud)

代替

quit
Run Code Online (Sandbox Code Playgroud)

每当发生这种情况时,就会gdb无限期地挂起,而我最终会使用kill -9 gdb_pid它来终止它。

我想问一下:

  • 为什么额外的括号会以这种方式()影响 的行为gdb
  • 有没有更好的方法来处理这个问题?例如 重新定义quit()quit,a patch,简单地了解为什么()不好......

的版本gdb7.11.90.20161005-0ubuntu2

linux gdb

5
推荐指数
0
解决办法
629
查看次数

Bash Parameter Substitution: command line vs. script

I am practicing with parameter substitution in bash.

I wrote the following dummy script:

#!/bin/bash

var1="/some/path/to/file/the_file.arbitrary.n.ext.0.random.ext"
var2="/some/path/to/file/the_file.arbitrary.n.ext.0.ext"

pattern='.[0-9]?(.random).ext'

echo "${pattern}"
echo "${var1/${pattern}/}"
echo "${var2/${pattern}/}"
Run Code Online (Sandbox Code Playgroud)

Basically, the pattern is meant to strip off the last part of the file name.


Executing the dummy script results in:

~$ ./dummy.sh 
.[0-9]?(.random).ext
/some/path/to/file/the_file.arbitrary.n.ext.0.random.ext
/some/path/to/file/the_file.arbitrary.n.ext.0.ext
Run Code Online (Sandbox Code Playgroud)

whereas evaling the script's contents or, equivalently, the direct input of that sequence of commands in the interactive shell, results in:

~$ eval "$(cat dummy.sh)"
.[0-9]?(.random).ext
/some/path/to/file/the_file.arbitrary.n.ext
/some/path/to/file/the_file.arbitrary.n.ext
Run Code Online (Sandbox Code Playgroud)

The …

bash shell-script bash-expansion

4
推荐指数
1
解决办法
918
查看次数

标签 统计

bash ×1

bash-expansion ×1

gdb ×1

linux ×1

shell-script ×1