|
|
#1 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,541
|
I am Bourne Again!
I'll let my 10.2 Terminal window speak for me:
[thermodynamics:~] mikey% bash bash-2.05a$ Yay! bash: Yay!: command not found bash-2.05a$ exit [thermodynamics:~] mikey% :-D Bash is included with 10.2! Rejoice. -/- Mikey-San |
|
|
|
|
|
#2 | |||||||||||||||||||
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
Re: I am Bourne Again!
Ahhh, so that's why nobody listens to me when I say use bash instead of tcsh! I have forgotten about installing bash and assumed it came with OS X. Great news that it's bundled with 10.2! Pity though that Apple didn't make it default. Now tcsh will continue to lure newbies into scripting with it.
__________________
/PEZ |
|||||||||||||||||||
|
|
|
|
|
#3 |
|
MVP
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
|
Anyone know if ksh is there in 10.2 ?
__________________
Douglas G. Stetner UNIX Live Free Or Die |
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
yes. ksh is not there in 10.2
|
|
|
|
|
|
#5 |
|
Triple-A Player
Join Date: Jul 2002
Location: Chicago
Posts: 81
|
So, is sh still zsh or is it bash now?
|
|
|
|
|
|
#6 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
sh is bash now
|
|
|
|
|
|
#7 |
|
Triple-A Player
Join Date: Jun 2002
Posts: 68
|
Code:
% whereis python /usr/bin/python |
|
|
|
|
|
#8 |
|
Triple-A Player
Join Date: Aug 2002
Location: Germany
Posts: 108
|
Could someone please explain in a nutshell (pun intended), what makes bash better than tcsh.
Yes, I too was lured to tcsh, and I like things like the dictionary, auto completion, history and such. So, what's the deal? Alex |
|
|
|
|
|
#9 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
|
|
|
|
|
|
#10 |
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
The thing is that since tcsh is such a Crappy Scripting Tool (tm) (see merv's post above) most of latest years shell development has gone into sh and ksh derivates like bash and zsh and what have you. Bash was early on bundled and default shell for most Linux dists so there's lots and lots of bash knowledge out there.
Besides bash is a blend between the tcsh's excellent interactive features and the ksh's excellent scripting model. So you won't miss out on anything when you switch to bash.
__________________
/PEZ |
|
|
|
|
|
#11 | |||||||||||||||||||
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
Re: ...and Python too!
Cool: thanks for the heads up. While I don't use python much (indeed, barely at all...), and always enjoy a little good-natured ribbing with its prophets, it's good to know that python is standard in 10.2. There are some *great* applications written using python (mailman jumps instantly to mind). Let those who ride decide! (Some people enjoy auto-erotic asphyxiation; me, I haven't really travelled that particular route, and tend to let it all "hang loose". This is all about scripting languages, right?) Cheers, Paul |
|||||||||||||||||||
|
|
|
|
|
#12 | |||||||||||||||||||
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
Re: Re: ...and Python too!
And let's not forget that Python gets a lot attention these days and that many "serious" developers are deep into Python. We need some of those in the OS X camp. =)
__________________
/PEZ |
|||||||||||||||||||
|
|
|
|
|
#13 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
Re: Why use bash?
one word: functions! bash aliases don't handle arguments like tcsh aliases. but, tcsh doesn't have functions (AFAIK)! bash functions handle args, and a whole lot more. bash functions are really swell. they're like aliases, but they're mini-scripts with all the structure of true sh scripts (AFAIK). they can be quite powerful. they reside in your shell variable space, so there's a little memory penalty. but speed is the trade-off. they execute in your current shell context; no new process is created to run the function, as opposed to shell scripts. there is also local variable declaration. and they're recursive. Code:
zfp () { # find process(es)
# handle multiple args by
# translating spaces to the egrep metachar |
local ss ; ss=`echo "$@" | tr " " "|"` ;
# sort by real mem size, be
# reasonable and display the ps header
ps wwaxum | egrep -i "${ss}| PID %CPU " | grep -v 'egrep -i' ;
}
# can't do that in tcsh - ha ha
# example:
$ zfp cron inetd slpd bash
USER PID %CPU %MEM VSZ RSS TT STAT TIME COMMAND
merv 1002 0.0 0.1 2204 1204 p1 Ss 0:01.34 bash --login
merv 1092 3.0 0.1 2204 1164 std Ss 0:01.22 -bash (bash)
root 362 0.0 0.0 5108 520 ?? Ss 0:07.58 slpd -f /etc/slpsa.conf
root 351 0.0 0.0 1560 132 ?? Ss 0:00.21 cron
root 299 0.0 0.0 1288 116 ?? Ss 0:00.01 inetd
|
|||||||||||||||||||
|
|
|
|
|
#14 |
|
Major Leaguer
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
|
Next...
Come on mT. With such a lovely template to work from it was a pleasure to render your claim ("# can't do that in tcsh - ha ha") false!
Try chucking the following single line into your .cshrc. alias zfp 'set ss=`echo "\!*" | tr " " "|"`;ps wwaxum|egrep -i "${ss}| PID %CPU "|grep -v "egrep -i"' Shell scripting in csh/tcsh may be a bit *nasty*, but aliases are still pretty useful. Indeed, as an interactive shell I think tcsh is really nice. Cheers, Paul ps While it *looks* like I'm an apologist for tcsh, I am in the process of changing allegiances to the "ta da" (drum roll please) Z-shell. Looks like lots of fun. (So does bash, but it's already got enough friends!) |
|
|
|
|
|
#15 | |||||||||||||||||||
|
Major Leaguer
Join Date: May 2002
Location: Sweden
Posts: 282
|
Re: Re: Why use bash?
Functions is a major thing. But there's more. There's actually a few things that the tcsh does that bash doesn't (like spell checking and tty sanity checking). Maybe spell checking can be added by user defined functions, but it's not built in and thus not widely available. But hey! You can always use zsh. zsh is very ksh (or POSIX sh) compatible and has all interactive bells and whistles you could ask for. But I stick to bash, because that's the main stream and for once I have decided to go with the flow. ![]() Check the comp.unix.shell "What shell?" FAQ It has a brief history of shells and a feature comparison table.
__________________
/PEZ |
|||||||||||||||||||
|
|
|
![]() |
|
|