The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   Installing Fink and Bash (http://hintsforums.macworld.com/showthread.php?t=4882)

Jacques 08-24-2002 12:24 AM

BASH Crumbs
 
I still haven't gathered particular portions - umm, why BASH anyhow?

Can someone point me to the thread or link that really started this BASHing?

Do most of you UN*X folk prefer BASH over the default Mac OS X shell? Why or why not?

vickishome 08-24-2002 12:43 AM

I considered that very same question a couple of weeks ago. Here's a couple of links you may want to check out:

http://www.mars.org/home/rob/docs/csh-whynot.html

http://docs.rinet.ru:8080/UNIXs/ch13.htm

Note that bash is an acronym for Bourne Again Shell.

I spent several hours rummaging through other links I found on Google, and I read the comments from others on Google Groups. Further, I have a friend who is a highly regarded consultant who knows Unix inside and out. He also blessed my switch from tcsh to bash.

What's interesting is that I've actually found even more references to bash being preferred since I made my decision to switch than when I was actively hunting for info. Unfortunately, since my decision was already made, I didn't keep track of the urls.

But I think what really hit home for me was that while I could find numerous references recommending bash over tcsh, I did not find one single recommendation for tcsh over bash. Not even one. I thought that was most telling of all.

I'm sure others with more experience can offer a more detailed reason for switching. But I highly recommend doing you own research on the web as well. Once you've looked into it, I think you'll find yourself wanting to install bash too.

sao 08-24-2002 02:11 AM

Vickishome,

After a good night sleep, I 'm back again.

It is great to know you have installed Fink and Bash successfully.

MervTormel advices on bash are the best to come around to the forums.

You're in good hands!

Sorry if you sensed a bit of bickering in the air between osxpez posts and mine.

My intention was to give you some information on how Fink works.

Intended for now and the future. Never suggested to you to do this way or the other exclusively.

Hope you enjoy bashing and the new toy (Fink).


Cheers...

sao 08-24-2002 02:31 AM

osxpez,

awk.....awk......awk....................awkkkk. :D


Cheers...


PS: ..........awk.......!!! :)

sao 08-24-2002 03:59 AM

osxpez,

now seriously..........you said:
Quote:

I think most users should avoid installing with the fink command.
I maybe would understand this advice for beginners, but for 'most users' as you said, I ask myself why?

The tool that Fink has for installing from source ('fink') is a wonderful tool. Extremely reliable and well done and executed.

What's your particular problem with this tool?

Is it because it isn't a Linux tool? I really don't know what your problem is.

I am eager to know, because if it is as bad as you suggest, maybe we should tell everybody, even to the Fink developers, so they can throw it away and doesn't cause more harm.

Please elaborate.

Sincerely...


Cheers...

osxpez 08-24-2002 05:20 AM

Quote:

Originally posted by sao
I maybe would understand this advice for beginners, but for 'most users' as you said, I ask myself why?
Because I think most users will stay in the state of relative ignorance about the mechanics of compilation and stuff so that they will have trouble to cope with the problems that can arrive when using the fink command. Most users probably will not be ready to put enough efforts into helping out testing the packages to be of much use for the Fink team either. apt-get just gives Joe user less trouble than fink I think.

Quote:

Originally posted by sao
even to the Fink developers, so they can throw it away and doesn't cause more harm.
No, please don't do that. I totally agree with you that fink is a great peace of software. It has obviously helped the whole Fink distribution to move extremely fast in getting those binary packages out. I'll just ask for a disclaimer telling Joe user to stick to apt-get most of the time and only use fink when there's a compelling reason and the user understands that reason.

Note that I consider myself to be one of those Joe users. Possibly in the more Unix-knowledgable half, but anyway. I have so far never had a need to move outside apt-get in my more than a year together with OS X. But I didn't know that at first and started out with "fink" which mostly went well, if slow, but a few times things refused to install and I spent days struggling with it. Then someone told me about apt-get and it felt like coming home. I just wished someone had told me about apt-get to begin with.

As for my preferences when it comes to Linux; I think GNU/Linux is great as a server OS, especially Debian. But on the desktop Linux sucks ass. You have to really and badly want to work with it. And even so there's zilch, zero, nada consistency in the GUI (or I should say GUIs because there are plenty in the same environment). OS X is king! And with Fink, no sane and, knowledgable enough, person wanting a Desktop Unix could ever choose Linux over OS X. The $100 or so it costs is way worth it. Not until the Linux community does something like Aqua will Linux ever catch up on Joe users desktops. I fully and completely adore the Fink developers. They are my heroes.

AKcrab 08-24-2002 05:30 AM

I downloaded, installed, configured fink once. I wanted some silly package, don't even remember what it was, but it recommended or required fink...
If someone would have offered me a built-in unixy method, I believe I would have taken it.
I'm still not even sure why I needed fink, as I've installed other packages successfully without it.

So Sao, why are you such a staunch supporter of fink? Can't install a package without it?

osxpez 08-24-2002 05:40 AM

On the tcsh vs bash subject. Though I think I have often said this. :) tcsh was a revolution to interactive shells when it arrived. But with it's csh heritage tcsh as a scripting tool pretty much sucks. ksh was the king of shell scripting back then. The developers of bash tried (and succeeded) to combine the power of the tcsh as an interactive shell (cloning much of it's features) with the scripting power of ksh. That leaves pretty few reasons to stick with tcsh I would say. Since bash other ksh derived shells has arrived as well, like zsh which is part of OS X 10.1 vanilla install. From what I heard zsh is at least as good as bash and adding interactive features at that.

I can see only one reason for some OS X'ers to stick to tcsh as their default shell. Because Apple insists on being stupid about tcsh and shipping OS X with tcsh as the default shell. Quite often you see install instructions and README's and stuff showing how to set up your environment, but only tcsh examples. So you have to know some tcsh and some bash to be able to translate those instructions to your bash environment. But it's not reason enough since it's quite a small obstacle.

sao 08-24-2002 06:12 AM

osxpez,

I agree with you in 99% of what you said.

Except, that if all users would be using apt-get and dselect only, the precompiled binary packages you enjoy now, the ones you are so happy to have installed in the last year with apt-get and dselect, will be much less in quantity and supply as they will be longer sleeping in the unstable branch.

So it works in your own interest really to promote the use of 'fink, the tool', not for all users, or the avarage Joe or Bob, but as an 'option' that users can consider.

Fink is a volunteer effort.

It is because of efforts from average users, together with the Fink developers, that you can enjoy the binary packages you are using now.

As this is the only way, by testing, that packages can get out of unstable and be made into precompiled binaries. The ones you love to install.

And you seem to have quite some experience like you said in the unix side of things:
Quote:

you wrote:
I fully and completely adore the Fink developers. They are my heroes.
So, as John F. Kennedy once said:

"Think not about what your country can do for you, but what you can do for your country"

With all your experience osxpez, what about testing some packages, to help the people you adore so much...your heroes.

The ball is with you, and the tools too.


Cheers...

sao 08-24-2002 06:17 AM

AKcrab,

What do you want?

Both osxpez and me agree 100% that Fink and the tools of Fink -apt-get, dselect, dpkg and fink are great.

So what's your problem?

I fail to understand.

You want to have a go?

If so, please, elaborate.


Cheers...

beus 08-24-2002 06:31 AM

AKcrab,

There are many threads in this Forum outlining the benefits of Fink (by Sao, MervTormel, osxpez, and others), not to mention numerous other sites you can visit. If you study a little you can discover, at the very least, why others find it such a useful tool. If you still feel it does not work for you, you are certainly entitled to your opinion, but I feel your comments have an overly negative tone which seems entirely out of place.

What's the matter...you can't install a package with Fink? ;)

beus

osxpez 08-24-2002 06:49 AM

Vicki: If you can live just a few days without your fancy tcsh prompt I think you can stay with bash as your default shell. You ask some very good questions and point out some of the more ugly parts of environment management. The main being "what should go where?" and "how does it matter?". Even professional Unix distributers sometimes don't know! I once had a freshly installed Mandrake Linux 7.x and it was evident that the Mandrake team had not succeeded in getting this right. I have a working setup on my OS X though and can share it and you can see if it helps any.

I have a symbolic link looking like this:

/bin/bash -> /sw/bin/bash

I'm not sure if Fink did this for me but if you don't have that link you can do:

$ ln -s /sw/bin/bash /bin/bash

Now for what goeas where and why. Not that I'm very good at it, but the bash man page tells us that an interactive login bash shell starts out with reading /etc/profile then goes on to read any ~/.bash_profile (I'm allowing myself to simplify it some). An interactive non-login shell starts with reading ~/.bashrc. (~/ means your home directory). Typically a non-interactive shell inherits it's environment variables from the parent shell so there's no need to but much environment variable setting in any bashrc file. The idea (I think) is to put aliases and functions and stuff into the bashrc files. Still with me? Good. Let's look at my startup files then. :) In the order of their execution as statet by "man bash".

Code:

$ cat /etc/profile
# system profile for sh shells
umask 002

(umask 002 makes me automatically create files that are readable by everybody and writable by me and users in my group while. I'm not sure if this was the default, but it's a sane setting I think.)

Code:

$ cat ~/.bash_profile
# .bash_profile

. /sw/bin/init.sh

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""

export USERNAME BASH_ENV PATH
export PAGER=less

The ". /sw/bin/init.sh" is there because Fink either put it there or told me to put it there. I have not tampered with that init.sh file. The command tells bash to "source" that init.sh file which means setting any enviroment variables and defining any functions and aliases in those files. This is different from just executing /sw/bin/init.sh which would not touch your environment at all. Dot (.) is the bash command for "source". I also source ~/.bashrc here since bash won't do that for login shells. Then some environment variables. (I can really recommend the last one, search this forums for a discussion about it.)

I think it's a quite vanilla ~/.bash_profile, but don't remember how (if) it differs from the original one.

So this means that my login shell does source ~/.bashrc which looks like this:
Code:

$ cat ~/.bashrc
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

alias ls='ls --color=auto'

stty erase '^?'

It starts out with sourcing /etc/bashrc and then defines an alias giving me colored output from ls (you need to "sudo apt-get install fileutils" to get this to work). The stty command there I need because my backspace key deletes the wrong characters otherwise (there's some threads in these Forums about that as well). You might not need it.

Let's move on:
Code:

$ cat /etc/bashrc
# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# are we an interactive shell?
if [ "$PS1" ]; then
    if [ -x /usr/bin/tput ]; then
      if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
        stty erase `tput kbs`
      fi
    fi
    case $TERM in
        xterm*)
            PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
            ;;
        *)
            ;;
    esac
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

    if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
            if [ -x $i ]; then
                . $i
            fi
        done
    fi
fi

# Falesafe
alias rm='rm -i'

Which sets up my prompt and (HEY! There's probably the stty command that *****s up my backspace key!) stuff. I haven't tampered with it much. What I seem to recall is moving stuff around to centralize stuff. The last loop makes it so that i can put .sh files in /etc/profile.d/ and have them sourced as well. A good way to communicate what's going on. I could put a file there called /etc/profile.d/aliases.sh and centralize all my aliases. I don't use it currently since, as you can see, I have a rather minimalistic set of aliases and environment variables and stuff. By experience I have found that the "alias rm=rm -i" can save trouble. Do "man rm" if you're interested.

With this set up I can put all environment variables that should be used for all users in /etc/profile and all aliases and functions that should be used by all users in /etc/bashrc. Any PEZ local stuff I put in ~/.bash_profile and ~/.bashrc.

You can make backup copies of any versions of these files you have and then try my setup. Also you can post your ~/.login and ~/.tcshrc and what have you and people here can try help you mimic your prompt and aliases.

osxpez 08-24-2002 07:04 AM

Quote:

Originally posted by sao
I agree with you in 99% of what you said.

Except, that if all users would be using apt-get and dselect only, the precompiled binary packages you enjoy now, the ones you are so happy to have installed in the last year with apt-get and dselect, will be much less in quantity and supply as they will be longer sleeping in the unstable branch.
That actually makes it 100% because I never said all usres. I said most users. One thing about me is that I always try to be exact when I way something. :)

Quote:

Originally posted by sao
With all your experience osxpez, what about testing some packages, to help the people you adore so much...your heroes.
I'm affraid I would only mess things up since the occasions when I have this much spare time as at the moment are rare and I wouldn't have time to give any valuable feedback. When I get the time I tend to try to use it to help people getting to know the marvels of Unix. That's my quest. I love Unix.

sao 08-24-2002 08:32 AM

osxpez,

To be exact and precise, the following hardly seems a statement for 'most' users, but in the contrary, for all users who read it.

Quote:

osxpez wrote:
But avoid the "fink" command and stick with apt-get and dselect. You'll get tons of advice in these forums to do fink this and fink that. Disregard them all and remember I told you to stick with apt-get and dselect. I only use fink to get the list of available packages.
Quote:

I'm affraid I would only mess things up since the occasions when I have this much spare time as at the moment are rare and I wouldn't have time to give any valuable feedback. When I get the time I tend to try to use it to help people getting to know the marvels of Unix. That's my quest. I love Unix.
Oh, come on, only excuses...rhetoric.

You can easily leave your terminal or several running in the back installing and still you could give advice about your unix love. I do it all the time.

Anyhow, let's leave it at that. Sorry to have bothered you, and have a happy time using what you take from Fink and giving your good advices. I personally learned a lot from your bash post above.


Cheers...

rusto 08-24-2002 10:57 AM

Vicki,

Here's an in depth page (with many examples) on the Bash prompt:

http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/

Here's the one I currently use (Teminal set to black background, white text):

Code:

PS1="\[\033[1;33m\][\@][\u:\w]\[\033[0m\]\n\$ "
The feature I like best of this prompt is that "\n" near the end which puts the "$" on a new line so that if the path displayed in the prompt gets really long, I always have a fresh line to enter commands on.

vickishome 08-24-2002 11:18 AM

osxpez, thank you for sharing your config files! Merv gave me his config files last night, but it was late and I was blurry-eyed so I just plopped them into my ~ dir and let it go at that. I'm going to copy your config files as well which will give me two examples of each file to work with. My first real Unix goal is to learn enough to comprehend what's in each set of config files so that I can edit them to only include what works best for me.

I have put echo tags in each file so I can track which files run when I start bash or tcsh (thanks to that long thread you guys posted long ago). This way I can see when each config file runs. This also helps me to figure out which config file to look at when there's an error.

rusto, thank you! I definitely miss my old prompt.

Regarding the question of fink/not fink... whether you guys meant to or not, you have both helped me to better understand what fink can do. I had read the info on the fink website, but that didn't quite explain it all as well as you two have. :)

vickishome 08-24-2002 11:35 AM

BTW, I must be missing something in my bash environment. Chown doesn't work! In fact, there are a number of things not working right.

For some reason, my /sw/bin/init.csh file said it was an Adobe image file. :confused: I know it's possible to change the file types using Unix, but I don't know those commands yet so I took the long route to fix the problem. I used BBEdit to copy the entire file, and put it in another file I named /sw/bin/init.csh2. Then I proceded to change the group and owner to match the original init.csh file. I had already switched to using bash as my startup shell. Chgrp worked just great. But when I attempted to use Chown, it said "command not found."
Code:

$ chown root newfile
bash: chown: command not found

Also, look at what happens when I attempt to use man:
Code:

$ man chmod
man: Formatting manual page...
There is no -F option ("less --help" for help)

$ man chown
man: Formatting manual page...
There is no -F option ("less --help" for help)

$ man chgrp
man: Formatting manual page...
There is no -F option ("less --help" for help)

Here's my tagging echos showing what's running when I start a new bash shell. As I mentioned before, I'm running Merv's config files which have not been edited to fit my environment so I get a couple of errors at startup:
Code:

Environment Setup Tagging:  Running ~/.bash_profile
Environment Setup Tagging:  Running /sw/bin/init.sh
Environment Setup Tagging:  Running ~/.bashrc
Environment Setup Tagging:  Running ~/.bash_aliases
Environment Setup Tagging:  Running ~/.bash_cdvars
bash: shopt: login_shell: unknown shell option name
Sat 24 Aug 2002 @ 10:25:24 CDT

10:25AM  up 19:48, 4 users, load averages: 0.14, 0.01, 0.01

vicki    console  Aug 23 14:38
vicki    ttyp1    Aug 24 08:51
vicki    ttyp2    Aug 23 22:20
vicki    ttyp3    Aug 23 19:16

  UID  PID  PPID CPU PRI NI      VSZ    RSS WCHAN  STAT  TT      TIME COMMAND
  501  1324  1323  0  31  0    5876    960 -      Ss+  p1    0:00.16 -tcsh (
  501  1381  1323  0  31  0    5028    956 -      Ss+  std    0:00.02 -bash (
  501  1368  1323  0  31  0    5876    956 -      Ss+  p2    0:00.12 -tcsh (
    0  1405  1381  0  31  0    1344    304 -      R+  std    0:00.00 ps alm

  PID STAT    RSS      TIME COMMAND
  311 S    57400  38:21.80 /Applications/Internet Explorer.app/Contents/MacOS/
  63 Ss    41592  42:25.16 /System/Library/CoreServices/WindowServer
  314 S    34736  69:11.30 /System/Library/CoreServices/Classic Startup.app/Co
  303 S    30784  0:28.72 /System/Library/CoreServices/Finder.app/Contents/Ma

Pageouts:                          0.

bash: netstat: command not found

du: illegal option -- h
usage: du [-H | -L | -P] [-a | -s] [-ckx] [file ...]
home size:

Capacity      Mounted

.-_-.-_-.-_-.
bash: fortune: command not found
.-_-.-_-.-_-.

Any idea where I should start looking to fix things?

Oh, I did eventually get my /sw/bin/init.csh file straightened out. I switched back to tcsh as my startup shell, and made the appropriate changes that way. I just need to figure out what's wrong with my bash environment. I suspect I have a wrong path in a config file somewhere??

vickishome 08-24-2002 01:21 PM

Got my man pages back in bash now. And chown is working again. :)

Merv's config files are so complex, I couldn't make heads or tails out of them. So I saved them elsewhere and plugged in osxpez's configs listed above. Now my man pages are back and chown is working.

I also created the symbolic link you suggested, osxpez. Plus, I installed the utils you suggested (ls is in color! yeah!). I think I'll run with your simpler config files until I know what I'm doing a little better.

I hadn't originally planned on switching to bash right now, but the book I'm reading uses bash in its examples, and so if I want to continue following the examples, I felt it was time to get bash installed. I believe I'm now at a point in which I can continue to read the book and run the examples myself so I have accomplished the goal I wanted. :) I have bash set up as my startup shell now. If I run into problems with bash, it's extremely easy to change my terminal preferences to fallback to tcsh so I haven't lost anything.

osxpez, I am curious about the backspace key problem you're having. How can I find out if I'm also having that problem (thus, require the code in the configs to remedy it)? Since I'm now running your configs, I don't know how to test to see if I require that code in my configs or not. Can you elaborate on the backspace key problem or point me to a thread where you may have discussed it before?

SpongeBob 08-24-2002 01:44 PM

I might have missed someone's reply on this but bash is installed in the 10.2 installation. It's in /bin/bash. No fink required. That's for the people who aren't quite up for a fink install or like me are waiting for the couple of fink packages that I use to be updated before reinstalling fink.

vickishome 08-24-2002 01:54 PM

Quote:

Originally posted by SpongeBob
I might have missed someone's reply on this but bash is installed in the 10.2 installation.
Right. Those who are upgrading to Jag can totally skip this entire thread since bash is already installed on Jag.

However, I'm going through these steps because I'm not installing Jag yet, but I want bash now.

Just think... only 4 months ago, I was running my G3 with OS 8.1! Going to OS X/Unix/tcsh/bash/fink his has been a huge jump for me (and that doesn't include the fact that I have a new G4, new printer, new scanner and tons of new, upgraded software). I'm going to stick with OS X 10.1.5 until I finally catch my breath on all of these changes.


All times are GMT -5. The time now is 10:35 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.