Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the linux "dialog" utility to create a simple UI. However, there is a text in infobox and I want to insert tab characters in order to properly align the text.

But it seems, that dialog does not accept tab character. Also, the --tab-correct option did not help. If I write \t, it apperas at \t in the infobox.

dialog --title "Hello" --tab-correct --infobox "tab \t test" 20 100

If I insert a tab in the command string:

dialog --title "Hello" --tab-correct --infobox "tab         test" 20 100

it appears as a single space.

Is there a way to insert tab in the infobox text?

share|improve this question
up vote 1 down vote accepted

You should use the --no-collapse option, instead of --tab-correct, and insert literal tabs in your string, for example with

"star "$'\t'" end" 

or using Ctrl-v and pressing the Tab key.

share|improve this answer
Thank you very much! This --no-collapse option solved the problem :) – Nuclear Apr 4 '12 at 14:20

Well, I don't know dialog, but sometimes in Linux when \t doesn't interpreted as Tab, try

"`echo -e "\t"`"

Try this:

declare -r TAB="`echo -e "\t"`"
echo -e "A${TAB}B"
share|improve this answer

The command string you say that appears as a single space is appearing as 8 spaces here, not a tab (but maybe that's StackExchange).

Debugging this may be a bit tricky. There are several things that may or may not "cook" tabs: the terminal, when inserting the character; the shell, when processing the input; the underlying terminal mode (cooked mode vs. raw mode), and, in the end, dialog itself.

To make things even more confusing, if you use echo to generate a tab, or if you somehow else generate a tab, there's still a chance the terminal emulator decides to wash that off.

A commonly seen keystroke to escape this kind of control characters is C-v (that is, Control+V, CTRL+V). If you hit that, then tab, you may get a real tab inserted. Here with the GNU bash and urxvt, it works.

Properly debugging this requires knowing exactly what's the issue (that is, what's eating the tab). Simply putting \t there won't work unless either dialog or your shell have the feature to translate these escaped sequences. If you want those, then follow @Eran Ben-Natan's advice and use GNU echo's enhanced mode (other implementations may/will differ — there's no specific behavior specified in POSIX (IEEE 1003.1 2008, page 2615, line 84306)).

share|improve this answer

Your Answer


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.