|
|
#1 |
|
Triple-A Player
Join Date: Jul 2002
Posts: 63
|
A little help with bash.
Hi,
I have 3 questions about bash. Here they are: 1) How can I get completions at the command line similar to those I was used with tcsh? Does Fink's package bash-completion work under 10.3? 2) How can I set up an alias that pipes ls result to less? I've tried with: Code:
alias ll='ls -al "$@"|less' 3) When I create a new shell not via Terminal app, the new shell doesn't source my .bash_profile where I put all my alias and so on. How can I fix this? Thanks, Andrea. |
|
|
|
|
|
#2 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
1. completion (shopt progcomp) is enabled by default in bash. fink's bash completion pkg works well with >= bash v2.04
is some completion failing? 2. bash aliases don't do variable substitutions. create a bash function for that case: Code:
$ declare -f ll
ll ()
{
TERM=ansi /bin/ls -GFlAho "$@" | less -FR
}
it's important to know how the startup sequence works and the difference between a login shell and a subshell [ at the bash prompt, enter bash to start a subshell. note that .bash_profile wasn't sourced, but .bashrc was ] it is a convention that .bash_profile source .bashrc i refer you to the man pages for bash. i know it seems daunting, but it'll serve you well to be familiar with the fundamentals. |
|
|
|
|
|
#3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Jul 2002
Posts: 63
|
Well it seems not to work at all here. For example when I type Code:
$ man ba Code:
$ man bash
Thanks.
I'll look at the man pages... Cheers, Andrea. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
well, if you were to install fink's bash-completion pkg, it provides man page completion, among many others.
the default completion is pretty simple, and programming your own completion can be complex. e.g. Code:
$ grep -C1 'complete.* man' /sw/etc/bash_completion [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ -o $UNAME = FreeBSD -o $UNAME = SunOS ] && complete -F _man $filenames man |
|
|
|
|
|
#5 | |||||||||||||||||||
|
Major Leaguer
Join Date: Dec 2002
Posts: 441
|
Which is where zsh comes in... |
|||||||||||||||||||
|
|
|
|
|
#6 |
|
Triple-A Player
Join Date: Jul 2002
Posts: 63
|
Thanks a lot to mervTormel. Everything works as I wanted. Regarding completions I'll look at the fink's package, I hope it'll fulfill my needs.
For gatorparrots: I've heard something about zsh, but I'm not sure taht changing Apple's default would be a good idea. Cheers, Andrea. |
|
|
|
|
|
#7 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
changing the default is harmless. migrating from one shell to another takes a bit of planning, dedication and work. if you are new to bash, you might want to skip straight on over to zsh. it has a lot of great features at a ~steep learning curve price. |
|||||||||||||||||||
|
|
|
|
|
#8 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jul 2002
Posts: 63
|
Thanks for your suggestions. I'll consider zsh. Cheers, Andrea. |
|||||||||||||||||||
|
|
|
|
|
#9 |
|
Major Leaguer
Join Date: Dec 2002
Posts: 441
|
dipping the toes into zsh
Gary Kerbaugh's zsh setup scripts makes jumping into zsh in an OS X environment fairly easy:
http://kerbaugh.uncfsu.edu/zsh.tar.gz W.G. Scott has a nice primer on zsh under OS X here: http://www.chemistry.ucsc.edu/~wgscott/xtal/zsh.html |
|
|
|
![]() |
|
|