[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alias and if
From: |
Bob Proulx |
Subject: |
Re: Alias and if |
Date: |
Sun, 4 Dec 2005 11:06:48 -0700 |
User-agent: |
Mutt/1.5.9i |
XIAO Gang wrote:
> #! /bin/bash
>
> if true; then
> alias myls=ls
> alias -p
> myls
> fi
>
> myls
In a script it is considered better form to use shell functions than
to use aliases. Aliases are an old csh feature. Functions generally
provide that functionality in a better fashion.
#!/bin/bash
if true; then
myls() { ls; }
myls
fi
myls
Bob