Berkeley CSUA MOTD:Entry 12397
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/28 [General] UID:1000 Activity:popular
5/28    

2004/2/25 [Computer/SW/Unix] UID:12397 Activity:moderate
2/24    In a unix shell (tcsh/bash) how to do I tell the terminal how many
        spaces to use for a tab (e.g, more,less,cat,pico,vi,emacs)?
        \_ This has nothing to do with the shell.  less might have a
           configurable way of displaying this, but in general you'll be doing
           this setting in pico, vi, and emacs separately.  Really, you should
           use "soft tabs" (i.e. when you hit tab, it really hits space four
           times, then on multiples of 8 converts back to real tabs)
           \_ that's what I do, but I don't like it.  With code, there should
              be a single character representing a single layer of indentation.
              It's philosophical, yes; and astyle works very well.  But still.
              \_ That's bizarre and arbitrary.  The most important things are
                 consistency and readability.  If tabs do that for your group,
                 then tabs are the answer.  If spaces do, then that's the
                 answer.
        \_ http://www.jwz.org/doc/tabs-vs-spaces.html
ERROR, url_link recursive (eces.Colorado.EDU/secure/mindterm2) 2025/05/28 [General] UID:1000 Activity:popular
5/28    

You may also be interested in these entries...
2012/8/29-11/7 [Computer/SW/Security] UID:54467 Activity:nil
8/29    There was once a CSUA web page which runs an SSH client for logging
        on to soda.  Does that page still exist?  Can someone remind me of the
        URL please?  Thx.
        \_ what do you mean? instruction on how to ssh into soda?
           \_ No I think he means the ssh applet, which, iirc, was an applet
              that implemented an ssh v1 client.  I think this page went away
	...
2012/9/20-11/7 [Computer/SW/Unix, Finance/Investment] UID:54482 Activity:nil
9/20    How do I change my shell? chsh says "Cannot change ID to root."
        \_ /usr/bin/chsh does not have the SUID permission set. Without
           being set, it does not successfully change a user's shell.
           Typical newbie sys admin (on soda)
           \_ Actually, it does: -rwsr-xr-x 1 root root 37552 Feb 15  2011 /usr/bin/chsh
	...
2012/9/24-11/7 [Computer/SW/Languages, Computer/SW/Unix] UID:54484 Activity:nil
9/24    How come changing my shell using ldapmodify (chsh doesn't work) doesn't
        work either? ldapsearch and getent show the new shell but I still get
        the old shell on login.
        \_ Scratch that, it magically took my new shell now. WTF?
           \_ probably nscd(8)
	...
2012/3/29-6/4 [Computer/HW/Memory, Computer/HW/CPU, Computer/HW/Drives] UID:54351 Activity:nil
3/29    A friend wants a PC (no mac). She doesn't want Dell. Is there a
        good place that can custom build for you (SSD, large RAM, cheap video
        card--no game)?
        \_ As a side note: back in my Cal days more than two decades ago when
           having a 387SX made me the only person with floating-point hardware,
           most machines were custom built.
	...
2012/4/27-6/4 [Computer/SW/Languages/Misc, Computer/SW/Unix] UID:54372 Activity:nil
4/27    I wrote a little shell script to collect iostat data:
        #!/bin/bash
        DATE=`date +%m%d`
        DATADIR=/var/tmp/user
        OUTPUTFILE=$DATADIR/$DATE.out
        while true
	...
2012/1/27-3/26 [Computer/SW/Unix] UID:54299 Activity:nil
1/27    Interesting list of useful unix tools. Shout out to
        cowsay even!
        http://www.stumbleupon.com/su/3428AB/kkovacs.eu/cool-but-obscure-unix-tools
        \_ This is nice.  Thanks.
	...
2011/10/26-12/6 [Computer/SW/Unix] UID:54202 Activity:nil
10/24  What's an easy way to see if say column 3 of a file matches a list of
       expressions in a file? Basically I want to combine "grep -f <file>"
       to store the patterns and awk's $3 ~ /(AAA|BBB|CCC)/ ... I realize
       I can do this with "egrep -f " and use regexp instead of strings, but
       was wondering if there was some magic way to do this.
       \_ UNIX has no magic. Make a shell script to produce the ask or egrep
	...
2011/5/19-7/13 [Computer/SW/Languages/Misc] UID:54115 Activity:nil
5/19    If script A runs, and calls script B ..... is it possible for me to exit\
        script A based on results of script B and not continue?
        \_ assume any shell
        \_ Yes.
           \_ without passing the result to some stupid temp file?
              \_ It sounds like you want "scriptb || exit", which will run
	...
Cache (4300 bytes)
www.jwz.org/doc/tabs-vs-spaces.html
I think a big part of these interminable arguments about tabs is based on people using the same words to mean different things. In the following, Im trying to avoid espousing my personal religion here, I just thought it would be good to try and explain the various sects. People care vehemently about a few different things: When reading code, and when theyre done writing new code, they care about how many screen columns by which the code tends to indent when a new scope or sexpr, or whatever opens. When there is some random file on disk that contains ASCII byte 9, the TAB character, they care about how their software reacts to that byte, display-wise. When writing code, they care about what happens when they press the TAB key on their keyboard. Note that I make a distinction between the TAB character which is a byte which can occur in a disk file and the TAB key which is that plastic bump on your keyboard, which when hit causes your computer to do something. As to point 1: A lot of people like that distance to be two columns, and a lot of people like that distance to be four columns, and a smaller number of people like to have somewhat more complicated and context- dependent rules than that. On defaultly-configured Unix systems, and on ancient dumb terminals and teletypes, the tradition has been for the TAB character to mean move to the right until the current column is a multiple of 8. As it happens, this is how Netscape interprets TAB inside <PRE> as well. This is also the default in the two most popular Unix editors, Emacs and vi. In many Windows and Mac editors, the default interpretation is the same, except that multiples of 4 are used instead of multiples of 8. However, some people configure vi to make TAB be mod-2 instead of mod-4 see below. With these three interpretations, the ASCII TAB character is essentially being used as a compression mechanism, to make sequences of SPACE-characters take up less room in the file. Both Emacs and vi are customizable about the number of columns used. Unix terminals and shell-windows are usually customizable away from their default of 8, but sometimes not, and often its difficult. A third interpretation is for the ASCII TAB character to mean indent to the next tab stop, where the tab stops are set arbitrarily: they might not necessarily be equally distanced from each other. On the Mac, BBedit defaults to 4-column tabs, but the tabstops can be set anywhere. It also has entab and detab commands, for converting from spaces to tabs and vice versa just like Emacss M-x tabify and M-x untabify . As to point 3, the tab key: this is an editor user interface issue. Some editors like vi treat TAB as being exactly like X, Y, and Z: when you type it, it gets inserted into the file, end of story. With editors like this, the interpretation of point 2 is what really matters: since TAB is just a self-inserting character, the way that one changes the semantics of hitting the TAB key on the keyboard is by changing the semantics of the display of the TAB character. Some editors like Emacs treat TAB as being a command which means indent this line. And by indent, it means, cause the first non-whitespace character on this line to occur at column N . To editors like this, it doesnt matter much what kind of interpretation is assigned to point 2: the TAB character in a file could be interpreted as being mod-2 columns, mod-4 columns, or mod-8 columns. The only thing that matters is that the editor realize which interpretation of the TAB character is being used, so that it knows how to properly put the file characters on the screen. The decisions of how many characters by which an expression should be indented point 1 and of how those columns should be encoded in the file using the TAB character point 2 are completely orthogonal. My opinion is that the best way to solve the technical issues is to mandate that the ASCII 9 TAB character never appear in disk files: program your editor to expand TABs to an appropriate number of spaces before writing the lines to disk. That simplifies matters greatly, by separating the technical issues of 2 and 3 from the religious issue of 1. As a data point, my personal setup is the same as the default Emacs configuration: the TAB character is interpreted as mod-8 indentation;