如何在bash中设置4个空格标签 [英] How to set 4 space tab in bash
本文介绍了如何在bash中设置4个空格标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在VIM中看起来像 set tabstop = 4
,但是我不知道如何在 bash
It look like set tabstop=4
in VIM, but I don't know how to set it in bash
例如:
echo -e "1234567890\t321\n1\t2\n123\t1"
当前输出:
1234567890 321
1 2
123 1
我想要这样的输出:
1234567890 321
1 2
123 1
它可以显示在任何地方,就像 cat somefile
或 php -r'echo"\ t123";'
It can be shown in anywhere, just like cat somefile
or php -r 'echo "\t123";'
如何在bash中设置标签宽度?
How can I set tab width in bash?
推荐答案
那不是您的shell(或php或cat)的属性.管理输出的是您的终端.
That's not a property of your shell (or php or cat). It's your terminal that manages the output.
使用 tab
命令更改行为:
Use the tabs
command to change the behavior:
$ tabs 4
$ echo -e "a\tb"
a b
$ tabs 12
$ echo -e "a\tb"
a b
(在POSIX中指定了 tabs
,上面的输出是伪造的:它仍然是两个字母之间的制表符.)
(tabs
is specified in POSIX, and output above is "faked": it's still a tab character between the two letters.)
这篇关于如何在bash中设置4个空格标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文