LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-14-2009, 09:04 AM   #1
joeBuffer
Member
 
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Rep: Reputation: 42
Unhappy A question about the default tabstop in bash being 8.


The default tabstop in bash is 8. Is there a good reason for this? If not, how do you change it?
 
Old 08-14-2009, 09:15 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I just Googled and found one thread which rambled on about why you should not change it, but never talked about how TO change it. Pretty soon they were talking about how missionaries tried to change Bulgarian grammar. Now I have a headache......

Perhaps it is in the PS1 env. variable? Why can't I do "man PS1" on my machine? ARRRRRRRRRRRGH!!
 
Old 08-14-2009, 09:20 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
https://www.linuxquestions.org/quest...set-it-322368/
 
Old 08-14-2009, 09:25 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
I guess the origins of tab stops every 8 characters are in typewriters and thence in teletypes which were the commonest terminal in the early days of UNIX. Neither typewriters not teletypes had standardised tab stop positions but 8 was chosen as the commonest value.

Bash itself does not define the tabstop spacing; do you mean the terminal's tabstop spacing?

There's some relevant info here.
 
Old 08-14-2009, 09:32 AM   #5
joeBuffer
Member
 
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Original Poster
Rep: Reputation: 42
That's what I meant, the terminal. I don't really know.
Quote:
If your terminal has tabstops set at 12 characters, the same file would look like this:
How could you change your terminal tabstop setting?
I would assume it's the programs themselves that are doing it, I guess. I thought maybe it's altered in some way by something. I looked at that site, and it said "If your terminal has tabstops, etc." like I just quoted. The cat output was changed when the tabstop setting was different. I looked at the thread you posted the link to here, and used the setterm -regtabs 4 and it didn't change my cat output. The tabstops are still 8.

Last edited by joeBuffer; 08-14-2009 at 09:39 AM.
 
Old 08-14-2009, 09:34 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by joeBuffer View Post
That's what I meant, the terminal. I don't really know.

How could you change your terminal tabstop setting?
You could read the LQ thread link posted by pixellany.
 
Old 08-16-2009, 10:40 PM   #7
joeBuffer
Member
 
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Original Poster
Rep: Reputation: 42
I read it, it's just one of those questions where everyone's answer for it differs, and using their suggestions doesn't appear to work. I assumed that maybe it wouldn't be possible, since it would be the program doing it, and not bash or the terminal. I tried a couple of things that people suggested, and it wouldn't work. I wouldn't really mark this as solved, since I still don't see how you could do it really ... but I guess it's not too big of a deal.

Last edited by joeBuffer; 08-17-2009 at 07:23 AM.
 
Old 08-17-2009, 02:46 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What sort of terminal are you using? According to the setterm man page, -regtabs (an its other tab controls) only work on virtual terminals.

That makes sense; only when the terminal device is controlled by Linux itself can it control the tab stops. For other terminal types -- hardware (!) and hardware emulators including terminals in graphical windows -- then it's the device itself that has to be configured. How to do that is dependent on the device itself. What sort of terminal are you using?
 
Old 08-17-2009, 07:36 AM   #9
joeBuffer
Member
 
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Original Poster
Rep: Reputation: 42
On this page, it says that if the tabstop is changed, the tabs using cat will be changed:
http://hell.org.ua/Docs/oreilly/unix/upt/ch41_04.htm
That's the web page you gave for information.
---
I'm using gnome-terminal.
Code:
joebuffer@ubuntu:~$ tty
/dev/pts/1
joebuffer@ubuntu:~$ echo $TERM
xterm
joebuffer@ubuntu:~$ cat .vimrc
set nocompatible
syntax on
set tabstop=4
set bs=2
set number
joebuffer@ubuntu:~$ vim tabstop4_example
joebuffer@ubuntu:~$ cat tabstop4_example 
abc
	def
		ghi
joebuffer@ubuntu:~$ cat > cat_example
abc
	def
		ghi
joebuffer@ubuntu:~$ setterm -regtabs 4
joebuffer@ubuntu:~$ cat tabstop4_example 
abc
	def
		ghi
joebuffer@ubuntu:~$ cat > cat_example
abc
	def
		ghi

Last edited by joeBuffer; 08-17-2009 at 07:38 AM.
 
Old 08-17-2009, 09:21 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
The tabstops set in vi only control how vi displays them; it doesn't affect the saved file which simply contains tabs. regtabs only controls virtual terminals. I believe those are the ones you get using Ctrl+Alt+F[1-6] so does not include gnome-terminal.

Did you try the tabs command as suggested here?

Another avenue to try is termcap. gnome-terminal settings are affected by the termcap settings in /usr/share/vte/termcap/xterm. I think hts is used to define tabstops ...
 
Old 08-17-2009, 09:50 AM   #11
joeBuffer
Member
 
Registered: Jul 2009
Distribution: Ubuntu 9.04
Posts: 328

Original Poster
Rep: Reputation: 42
Thanks for your help, I'm sure this is all the information I need. I'm gonna mark this as solved, because I have the information I personally needed, but I haven't done this. I haven't gotten it to work yet, but I know this is all the information I really needed to help me solve this problem. I just wanted to be pointed in the right direction at least, and have a yes/no answer as to whether or not it could or should be done.

Last edited by joeBuffer; 08-17-2009 at 09:52 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does setting of BASH as the default shell has any effect? msgforsunil Linux - Newbie 7 10-22-2006 10:41 PM
bash shell by default khattaking Solaris / OpenSolaris 13 08-08-2006 10:39 AM
How to change the default shell to bash? shadkong Slackware 12 04-23-2005 03:49 PM
Configureing OpenBSD to use bash by default Pizentios Linux - Software 4 09-13-2004 08:36 AM
KDE 3.1.1 made terminals use bash as default? red1busta Linux - Newbie 2 03-28-2003 11:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration