2

I was messing about with different wildcards and ran the following command:

ls testdir/!(*/)

after which I was completely unable to get back to the bash prompt. None of ^C, ^D, or even ^Z worked: they just printed those literal characters.

Update: I discovered that simply typing:

ls !()

had the same effect. Removing my .bash_history did not help.

So, two questions:

  1. Is it possible to recover from that command?

  2. What exactly did I tell bash to do and what's it waiting for?

Notes:

If I just run !(*/) it just says "event not found"

If I run ls !(*/) or echo !(*/) then it does the same as above

The bash processes are in the list at 100% CPU, but not ls

Running the same command on an lxc container just gives "event not found" My bash options are pretty much stock Ubuntu 14.04. Nothing weird.

Using set -x before the ls command doesn't echo anything.

Notes2: Output from shopt

autocd          off
cdable_vars     off
cdspell         off
checkhash       off
checkjobs       off
checkwinsize    on
cmdhist         on
compat31        off
compat32        off
compat40        off
compat41        off
compat42        off
complete_fullquote  on
direxpand       off
dirspell        off
dotglob         off
execfail        off
expand_aliases  on
extdebug        off
extglob         on
extquote        on
failglob        off
force_fignore   on
globstar        off
globasciiranges off
gnu_errfmt      off
histappend      on
histreedit      off
histverify      off
hostcomplete    off
huponexit       off
interactive_comments    on
lastpipe        off
lithist         off
login_shell     off
mailwarn        off
no_empty_cmd_completion off
nocaseglob      off
nocasematch     off
nullglob        off
progcomp        on
promptvars      on
restricted_shell    off
shift_verbose   off
sourcepath      on
xpg_echo        off

Output from set +o

set +o allexport
set -o braceexpand
set -o emacs
set +o errexit
set +o errtrace
set +o functrace
set -o hashall
set -o histexpand
set -o history
set +o ignoreeof
set -o interactive-comments
set +o keyword
set -o monitor
set +o noclobber
set +o noexec
set +o noglob
set +o nolog
set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o pipefail
set +o posix
set +o privileged
set +o verbose
set +o vi
set +o xtrace
10
  • Is it possible for you to kill ls command from other terminal ?
    – SHW
    Jul 17, 2015 at 7:22
  • The ls command does not appear in the process list. I guess it's not got started yet.
    – seumasmac
    Jul 17, 2015 at 7:32
  • You have to kill your bash instance, and closing the terminal will not do that. The bash instance will be running at 100%, use top to look it up.
    – Anthon
    Jul 17, 2015 at 8:00
  • For someone to tell (or guess well) what happened, they'd need to know what options were set in your shell and what that * expanded to. It looks like ordinary history expansion, but I can't really see how that could hang bash. Jul 17, 2015 at 8:09
  • Ah, yes, just tried the same command on a container, and it just gives "event not found" so clearly the first thing is it's pulling something from my history. I'll see if I can figure out what.
    – seumasmac
    Jul 17, 2015 at 8:18

1 Answer 1

1
shw@shw:/tmp $ ls testdir/!(*/) & pidls=$!
[1] 18453
shw@shw:/tmp $ 
shw@shw:/tmp $ cat /proc/18453/cmdline 
bashshw@shw:/tmp $ 
shw@shw:/tmp $ 
shw@shw:/tmp $ kill -9 18453
shw@shw:/tmp $ 
[1]+  Killed                  ls --color=auto testdir/!(*/)
shw@shw:/tmp $ 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .