Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 12-17-2003, 10:35 AM   #1
osxpounder
Major Leaguer
 
Join Date: May 2002
Location: atl, ga, usa
Posts: 356
"Unknown terminal type network!" at 2nd login

I'm using OSX Panther 10.3, Terminal, and of course the new default shell, bash.

When I login a 2nd time in the same Terminal window [for example, to test an alias I am creating in .bash_login], I can't run pico. I get this error message:

"Unknown terminal type network!"

Now, the first time I open a Terminal window, I'm already logged in, and apparently bash is satisfied that it knows my terminal type, because I can run pico sans problem.

But why not after logging in on top of my first shell? And how can I fix it? Please go slowly--remember this is the Unix Newcomers forum! I'm not a newcomer, but a perpetual newbie where *nix is concerned.

Thanks,

osxpounder
osxpounder is offline   Reply With Quote
Old 12-17-2003, 10:45 AM   #2
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
please describe "login a 2nd time in the same Terminal window"
mervTormel is offline   Reply With Quote
Old 12-17-2003, 11:52 AM   #3
osxpounder
Major Leaguer
 
Join Date: May 2002
Location: atl, ga, usa
Posts: 356
Quote:
Originally posted by mervTormel
please describe "login a 2nd time in the same Terminal window"

Sorry.

I am already using a Terminal window, and, at the command prompt, I type "login", and login with the same user and passwd.

I do this to test a new alias, for example.

Thanks for asking.
osxpounder is offline   Reply With Quote
Old 12-17-2003, 12:02 PM   #4
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
try:

login -fp

or

bash --login

or

command-N
mervTormel is offline   Reply With Quote
Old 12-17-2003, 12:03 PM   #5
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
You shouldn't do a 'login' when you are already logged in. As you found out, it doesn't work - this seems to be a bug but doing 'login' is something you don't usually want to do anyway.

To test your changes to your .profile or .bashrc files, you could start a new shell via the command:
bash
This would start a new shell running inside your current shell. Not good if you do this a lot since you would build up a bunch of shells withing shells.

Better would be to close your current Terminal window and then open a new one. The new one will do a login and hence run all your 'dot' files.

Alternately, you could just "source" the 'dot' files that you have changed. In bash, you do this with the dot command - a single dot (.) followed by the name of the file. For example:
. ~/.profile
The downside of that is that tehre might be some things in your .profile etc that you don't wnat to do twice (e.g. adding to a PATH).
For this reason, I usually keep my aliases & functions in a separate file (e.g. .bash_aliases) so that I can source this file whenever I want to update it.
hayne is offline   Reply With Quote
Old 12-17-2003, 12:16 PM   #6
osxpounder
Major Leaguer
 
Join Date: May 2002
Location: atl, ga, usa
Posts: 356
Thanks!

So, if I wanted to move my aliases to .bash_aliases, would I have to do something to make sure that this file of aliases is used at every login?

I'm guessing, based on what I've read here, that I could move my aliases to .bash_aliases, then add a line to my .bash_login file that reads:

.~/.bash_aliases

... so that every time I login, the aliases get loaded [if that's the right verb for it].

I also assume that I'll have to chmod these .bash_* files to make them executable by me.

Am I right? If not, your suggestions welcome on the best way to ensure that my aliases are always available to me. I like the idea of separating them into a separate file with "aliases" in the name, for the sake of convenience in the future [after I've forgotten where the aliases go again...]
osxpounder is offline   Reply With Quote
Old 12-17-2003, 12:27 PM   #7
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
always leave yourself a shell window to fix what might be broken by edits in the shell startup scripts that may error and prevent you from being able to login

echo hayne about breaking out the shell defs into their own files for easy editing and testing...

.bash_aliases
.bash_cdvars
.bash_completion
.bash_functions
.bash_history
.bash_hostfile
.bash_logout
.bash_profile
.bashrc

another beauty here is adding aliases or functions can be done easily by defining a function to append to the appropriate file:

Code:
mkalias () 
{ 
    local name=$1 value="$2";
    echo alias $name=\'$value\' >>~/.bash_aliases;
    eval alias $name=\'$value\';
    alias $name
}
craft a working command line, feed it to mkalias:

$ mkalias aliasName 'onerous command line that i finally got working and never want to have to type again'

osxpounder: right, source the ~/.bash_aliases file in .bashrc:

Code:
  if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases ; fi
no, file does not need to be chmod +x ; "source a file" means something different to the bash shell than executing a file. "source" means "Read and execute commands from filename in the current shell environment "

Last edited by mervTormel; 12-17-2003 at 12:30 PM.
mervTormel is offline   Reply With Quote
Reply


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 On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.