Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I don't recall to have explicitly placed anything in my .bashrc file recently, but from yesterday I am able to see the command being displayed at the prompt before getting executed. I don't know how it got switched on and when?

Example

$ ls *abc*
ls *abc*  # ---> This line is getting displayed for every command, same command as it is
abc.txt temp_abc.c
$ pwd
pwd       # ---> This line is getting displayed for every command, same command as it is
/home/mtk/temp/

My bash details

$ bash --version
bash --version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

It's weird and doesn't seems to be of much use. But I would like to know how to turn this feature on and off? What command/setting does this?

share|improve this question
    
diff -u /etc/skel/.bashrc ~/.bashrc might help.. checked on Debian –  Tshepang Oct 17 '12 at 7:25
2  
What is trap's output? –  manatwork Oct 17 '12 at 8:04
    
@manatwork ah yes, DEBUG trap. didn't think of that. –  ormaaj Oct 17 '12 at 8:05
1  
@mtk If it isn't the DEBUG trap then yet another possibility is set -x. If somebody did PS4=; set -x then you would get this effect. set +x to disable that. If that isn't the problem, then enabling set -x might help you to debug it. –  ormaaj Oct 17 '12 at 9:16
2  
Don't forget set -v. That output looks more like set -v than set -x, which would expand globs and have a leading + . –  jw013 Oct 17 '12 at 16:43

1 Answer 1

edit - essentially the list of possibilities:

  • if trap -p DEBUG is non-empty then trap - DEBUG
  • if typeset -p PROMPT_COMMAND non-empty then unset -v PROMPT_COMMAND
  • if echo "$-" contains x then set +x. Also your PS4 would seem to be unset or empty.
  • if PS1 contains something weird like a command substitution redirected to stderr, set it to something sane.
  • Possibly something in ~/.inputrc, or a terminal setting (stty), or a misbehaving completion function.

In all of the above, figure out what sets it. Either ~/.bashrc, /etc/bashrc, or some other location under /etc that is sometimes set by distros at compile-time.

share|improve this answer
    
Not working... bash: typeset: PROMPT_COMMAND: not found –  mtk Oct 17 '12 at 7:50
2  
@mtk Strange. There aren't really any other hooks in Bash that could allow this to happen. The other possibilities I can think of are a readline setting (check your ~/.inputrc), or maybe an stty setting that I don't know about (try stty sane). –  ormaaj Oct 17 '12 at 8:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.