Terminal question - teaching myself

Discussion in 'Mac Apps and Mac App Store' started by Awimoway, Mar 13, 2004.

  1. Awimoway macrumors 65816

    Joined:
    Sep 13, 2002
    Location:
    at the edge
    #1
    In my spare time this weekend, I am beginning to teach myself how to use Terminal. There is a really nice tutorial that I am using. But it seems to be a little outdated in places. It's not taking into account that tcsh has been replaced with bash in Panther. (I confess I don't entirely understand what that even means, but at the very least it seems to mean that some Terminal-related file names are different. For example, when the tutorial speaks of .tcsh_history, it is now .bash_history. However there are still some tcsh-related things around, so I'm not sure when to substitute bash for tcsh and when to leave things alone. There may not be an easily comprehensible rule of thumb for a noob like me, but at the very least I would like a little guidance with this section of the tutorial:

    I would like to add these safety features, since I'm new at this at don't want to do anything stupid. But I'm not sure about this .tcshrc file. I don't have one right now. Is it fine to name it this? Should it be .bashrc? Am I making any sense? Help would be much appreciated.
     
  2. Doctor Q Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #2
    I hope you'll have lots of fun learning to use Terminal, Awimoway. Before you start adapting the tcsh tutorial for the bash shell, why not just use tcsh instead? If you specify Execute this command (specify complete path): /bin/tcsh in Terminal's preferences, you should get tcsh when you open a Terminal window.
     
  3. Awimoway thread starter macrumors 65816

    Joined:
    Sep 13, 2002
    Location:
    at the edge
    #3
    Cool! Thanks for the tip. Somehow I thought that you couldn't choose your shell and that Panther had bash locked in. This solution works nicely. I understand that bash is more common, but since the differences aren't major and the helpful, free tutorial I've found uses tcsh, I think I'll just stick with it for a while. Thanks again. :)
     
  4. Awimoway thread starter macrumors 65816

    Joined:
    Sep 13, 2002
    Location:
    at the edge
    #4
    Okay, one other quick question. This one's not essential, but it would be nice to have. How do I create a .tcsh_history file that keeps a record of my doings? Because I only have the bash one and it won't be doing me any good while I use tcsh.
     
  5. encro macrumors 6502

    encro

    Joined:
    May 6, 2002
    Location:
    bendigo.victoria.au
    #5
    a better way is to change the global shell using (if your the admin):

    Welcome to Darwin!
    mymachine:~ encro$ chsh /bin/tcsh

    (You only need to type it once to change your shell )
     
  6. encro macrumors 6502

    encro

    Joined:
    May 6, 2002
    Location:
    bendigo.victoria.au
    #6
    Welcome to Darwin!
    mymachine:~ encro$ touch ~/.tcsh_history
     
  7. abhishekit macrumors 65816

    abhishekit

    Joined:
    Nov 6, 2003
    Location:
    akron , ohio
    #7
    yah..as encro pointed out, the file is already there..touch or cat..
    cat ~/.tcsh_history

    and one more way to change the default shell. terminal-preferneces there you have a check button called 'execute this command' check it and specify /bin/tcsh in the box below
    cheers
     
  8. titaniumducky macrumors 6502a

    titaniumducky

    Joined:
    Nov 22, 2003
    #8
    Only type in the "chsh /bin/tcsh" part. The rest is stuff on ecro's Terminal screen which will cause an error (user, dir, etc.).
     
  9. Awimoway thread starter macrumors 65816

    Joined:
    Sep 13, 2002
    Location:
    at the edge
    #9
    After typing in:

    chsh /bin/tcsh

    I got the following response:

    chsh: unknown user: /bin/tcsh

    I'm not sure what this means, but it seems that it didn't change the global default shell.

    And I've created the ~/.tcsh_history file, but when I'm in tcsh nothing seems to be getting written to it.
     
  10. encro macrumors 6502

    encro

    Joined:
    May 6, 2002
    Location:
    bendigo.victoria.au
    #10
    ooops wrong syntax :)

    it should be:
    chsh -s tcsh
     
  11. encro macrumors 6502

    encro

    Joined:
    May 6, 2002
    Location:
    bendigo.victoria.au
    #11
    Thats because you haven't enabled your history file (it's on by default as a part of bash though which I am using on Panther) but back when I was using Jaguar I had set up a .tcshrc file with the folliwing contents:

    Code:
    #######################
    #      .tcshrc settings file (~/.tcshrc)
    #      created by: encro
    #######################
    
    set color                       # use color display in the tcsh
    set complete = enhance          # Complete case insensitive.
    set autolist                    # List autocomplete alternatives when tab pressed
    set correct = cmd               # Correct misspelled commands
    set savehist = 100              # Save command line history when Terminal closed
    set history = 1000              # History remembered is 1000 commands.
    set savehist = (1000 merge)     # Save and merge with existing saved commands.
    
    # alias ls ls-F                 # set ls to use the built in tsch color ls
    
    # use a screensaver to animate the desktop, use only on quatz accelerated machines.
    alias screensaver /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background
    
    # allow X11 to be started in the same way as Linux.
    alias startx /Applications/X11.app/Contents/MacOS/X11
    
    # add any application you want to start from the command line here using an alias.
    alias ical "open /Applications/iCal.app"
    
    # set default path statements
    setenv PATH /usr/local/bin:$PATH
    setenv PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/Developer/Tools:
    
    and finally this is the ~/.bash_profile I use currently on OS X 10.3 Panther:
    Code:
    # .bash_profile
    #
    # Author: encro
    # Date Created: 30/10/2003
    # Last Edited: 05/02/2004
    
    # The next 3 lines refer to a color bash shell, personally I prefer
    # a GreenScreen for Terminal. Uncomment the lines if you like :-)
    # export TERM=xterm-color
    # export CLICOLOR=true
    # export LSCOLORS=dxfxcxdxbxegedabagaca
    
    # Assign my favorite editor to the EDITOR environment variable.
    export EDITOR=pico
    
    # I need to assign a printer to use on the command line.
    # Use the Printer Queue name as the Environment Variable
    # because the Printer Name is completely changeable/editable.
    export PRINTER=Stylus_C70
    
    # Some aliases to reduce typing :-)
    alias xcode='open -a /Developer/Applications/Xcode.app'
    alias ib='open -a /Developer/Applications/Interface\ Builder.app'
    alias mysql='/Library/MySQL/bin/mysql'
    alias mysqladmin='/Library/MySQL/bin/mysql_config'
    
    
    # I need to add some extra paths to the Mac OS X defaults
    . /sw/bin/init.sh # Fink Path Setup 
    PATH=$PATH:/usr/local/bin:/Developer/Tools
    # osascript -e 'say "Welcome to Darwin!"'
    
    Hopefully something is of use to you :)
     

Share This Page