How to set 4 space tab in bash

前端 未结 5 909
囚心锁ツ
囚心锁ツ 2021-02-01 16:11

It look like set tabstop=4 in VIM, but I don\'t know how to set it in bash

for example:

echo -e \"1234567890\\t321\\n1\\t2\         


        
5条回答
  •  执笔经年
    2021-02-01 16:15

    tabs 4 results in the following tabstop positions. Which isn't quite what you asked for.

    tab stop positions 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80
             1         2         3         4         5         6         7         8
    12345678901234567890123456789012345678901234567890123456789012345678901234567890
       *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
    

    You asked for this..

    tab stop positions 5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,80
             1         2         3         4         5         6         7         8
    12345678901234567890123456789012345678901234567890123456789012345678901234567890
        *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  *
    

    Specifying tabs with a single number creates an implicit list that starts from 0.
    To create an explicit list such as what you asked for. Provide a comma or space separated list of tab stop positions.
    Like so: tabs 5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77

    See man tabs and tabs -v for more details.

提交回复
热议问题