24
votes
3answers
1k views

How can I see the exact command line being executed inside some bash instance?

I have a long running bash instance (inside a screen session) that is executing a complex set of commands inside a loop (with each loop doing pipes, redirects, etc). The long command line was ...
21
votes
6answers
1k views

How to debug a bash script?

I'm having some problems with some scripts in bash, about errors and unexpected behaviors. I would like to investigate the causes of the problems so I can apply fixes. Is there a way I can turn some ...
1
vote
2answers
64 views

Double click Linux Bash Script and debug with pause commands

I'm fairly good with windows .bat scripts and normally use the pause command while developing them so I can see things step by step as the script runs in the command prompt. I am trying to do ...
1
vote
3answers
65 views

Bash script in ( set -x ) mode does not display what “cat” command does. ( contents of it )

in this bash script.. it simply shows.. +cat as it runs. #!/bin/bash set -x cat > /test << "EOF" a b c d EOF but i rather show everything that it does . including the a b c d ...
9
votes
4answers
321 views

How can I tell if the currently executing bash script has been invoked with -x for debugging?

I have a script launch.sh that executes itself as another user so as to create files with the correct owner. I want to pass -x to this invocation if it was originally passed to the script if [ ...
4
votes
3answers
175 views

Adding comments using 'set -x'

Sometimes it is really handy to just add set -x to the top of your script to show all commands before they are executed. There is only one drawback creating scripts with a decent output: I don't ...
1
vote
1answer
394 views

Is there a GUI debugger for shell scripts

Debugging bash scripts on command line is complicated. Is there a good GUI based debugger available for debugging bash scripts?
2
votes
0answers
80 views

“Debugging” with bashdb: why do I lose command echo after stepping into a simple script?

I heard about the bash debugger ( bashdb ) after reading a comment so I thought I should try it out and see if it can help me analyze bash scripts or more generally the execution of commands. There ...
1
vote
1answer
386 views

Bash option to get resolved executable path?

Bash is able to trace execution script commands with the -x command line option. Each command is then output to stderr, prefixed by PS4 as stated in the man page. -x After expanding each ...
6
votes
2answers
569 views

Is it possible to strace the builtin commands to Bash?

Inspired by this question, titled: When are the built-in commands loaded to memory, while attempting to answer this I tried the following command and was a bit surprised that I couldn't run it: $ ...
6
votes
2answers
367 views

bash: escape individual lines from `-x` echoing

In bash, when running with the -x option, is it possible to exempt individual commands from echoing? I'm trying to make the output as neat as possible, so I am running certain parts of my script in a ...
6
votes
3answers
2k views

How can I find what is interfering with CTRL+F?

I'm running LinuxMint12 with Gnome with Cario-Dock and I have a logitech G15 keyboard. I set up a bash script with the extra keys to take the active window, resize it, and move it to a specific ...