Next: , Previous: , Up: Running   [Contents][Index]


3.4 Your script’s input and output

By default, the script you run under the BASH debugger does input and output to the same terminal that BASH uses. Before running the script to be debugged, the debugger records the tty that was in effect. All of its output is then written to that. However you can change this when using the ‘bashdb’ script using the ‘-t’ option.

info terminal

Displays information recorded by the BASH debugger about the terminal modes your program is using.

Another way to specify where your script should do input and output is with the tty command. This command accepts a file name as argument, and causes this file to be the default for future restart commands. It also resets the controlling terminal for the child process, for future restart commands. For example,

tty /dev/ttyb

directs that processes started with subsequent restart commands default to do input and output on the terminal /dev/ttyb and have that as their controlling terminal.

An explicit redirection in restart overrides the tty command’s effect on the input/output device, but not its effect on the controlling terminal.

When you use the tty command or redirect input in the restart command, only the input for your script is affected. The input for the BASH debugger still comes from your terminal.