Re: .bashrc aliases
- From: Stephane CHAZELAS <this.address@xxxxxxxxxx>
- Date: Thu, 23 Feb 2006 08:18:16 +0000
2006-02-22, 13:13(-08), Xicheng:
[...]
[...]alias next='the command above'
with the proper punctuation. Thanks.
In bash, you can use 'function' instead of 'alias' which pretty much
does the same thing, so you may do:
function next() { osascript -e 'tell app "iTunes" to next track'; }
Where does that new trend for defining a function come from?
Does some manual or book advertise it?
That's the awk syntax, that's neither the ksh nor the Bourne
syntax. And it's not POSIX conformant. It just happens to work
for bash and zsh, because those shells just happen to ignore the
"function" there. They accept it because the ksh way includes
it.
ksh was the first (before the Bourne shell) to introduce
functions. It chose to write it as:
function next {
...
}
Then the Bourne shell chose to write it as:
next() {
...
}
Later on, ksh also accepted that one to be compatible with the
Bourne shell again (note that in ksh, those two define two
different kinds of functions, for instance the signal handling
is different for a function defined in one way than the same
function defined the other way).
The POSIX and UNIX specification only recognise the Bourne way.
Some Bourne-like shells, like bash or zsh implement the Bourne
way. They recognise the ksh way, but don't make any difference
contrary to ksh.
--
Stéphane
.
- References:
- .bashrc aliases
- From: dave
- Re: .bashrc aliases
- From: Xicheng
- .bashrc aliases
- Prev by Date: Re: change file names
- Next by Date: Re: How to sort block of text
- Previous by thread: Re: .bashrc aliases
- Next by thread: How to sort block of text
- Index(es):
Relevant Pages
|