- Linux Shell Scripting Cookbook(Third Edition)
- Clif Flynt Sarath Lakshman Shantanu Tushar
- 113字
- 2021-07-09 19:46:12
Displaying tabs as ^I
It is hard to distinguish tabs and repeated space characters. Languages such as Python may treat tabs and spaces differently. Mixtures of tabs and spaces may look similar in an editor, but appear as different indentations to the interpreter. It is difficult to identify the difference between tabs and spaces when viewing a file in a text editor. cat can also identify tabs. This helps you to debug indentation errors.
The cat command's -T option displays tab characters as ^I:
$ cat file.py def function(): var = 5 next = 6 third = 7 $ cat -T file.py def function(): ^Ivar = 5 ^I^Inext = 6 ^Ithird = 7^I