Newsgroups: comp.os.minix
Subject: Re: Can I use alias in Minix?
References: <slrn941tv9.bj.magiccom@Zenius.Mydomain> <6slmtanajp.fsf@iago.nac.net> <slrn943hsj.7b.magiccom@Zenius.Mydomain>
From: Mark Gray <markgray@iago.nac.net>
Cc: magiccom@hitel.net (Lee soonki)
Date: 21 Dec 2000 04:34:40 -0500
Message-ID: <6sn1dq15jj.fsf@iago.nac.net>
Lines: 68
X-Newsreader: Gnus v5.7/Emacs 20.4
NNTP-Posting-Host: iago.nac.net
X-Trace: 21 Dec 2000 04:34:41 -0500, iago.nac.net
Path: news.adfa.edu.au!clarion.carno.net.au!news0.optus.net.au!news1.optus.net.au!optus!intgwpad.nntp.telstra.net!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newspeer1.nac.net!nntp2.nac.net!iago.nac.net
Xref: news.adfa.edu.au comp.os.minix:36373

magiccom@hitel.net (Lee soonki) writes:

[snip]
> Thanks for your kind answer.
> but....although I have read a ash man page several times,
> I cannot use it. 
> 
> I tried in many ways like "#ls() ls -F" or "#ls() { ls -F }".
> but...it's useless and sometimes error message was produced.
> 
> Can you give me one simple example?

Sure thing --- here is a copy of my ~/.ashrc

markgray@k5 /usr/markgray $ cat .ashrc
# Ash initialization.

# Let cd display the current directory on the status line.
cd() {
        command cd $@
        PS1="$USER@k5 $(pwd)"
        if [ $USER = "markgray" ]; then
                PS1="$PS1 $ "
        else
                PS1="$PS1 # "
        fi
        export PS1
}
# define l as ls -laF
l() {
        /usr/bin/ls -laF $@; pwd;
}
# define su to change PS1
su() {
        if [ "$1" = "" ]; then
                export USER=root
                PS1="$USER@k5 $(pwd) # ";
        else
                export USER=$1
                PS1="$USER@k5 $(pwd) # ";
        fi
        export PS1
        /usr/bin/su $@
        export USER=markgray
        export PS1="$USER@k5 $(pwd) $ "
}
# define less to be more
less() {
        more $@
}
cd .
[end quote]

> If there was a example in the man page, it was much easier for a novice
> like me. But I can't find any example in man page.

I agree -- I think that the man page neglects to mention some of the
syntax -- I think that the "{" needs to be at the end of a line, and
the "}" needs to be on a line by itself.  (I vaguely recall some trial
and error getting the syntax right.)

> One more help can save me. :-) 

Also, make sure you are using ash as your shell -- I think functions
work with "sh" also, but it is missing some of the constructs and is a
lot less user friendly than ash.

Hope this helps.
