alias command within .profile

Please could someone advise me the command - to set up aliases commands within a .profile using shell sh

regards

venhart

Edit the .profile file , add the entry

aliase alias_name='command'

Hi, just tried this and I get the following error :

-sh: aliase: not found

The command i entered was :

aliase logs="cd /home/username/log"

regards

u have typed aliase
correct spelling is alias
use :
alias my_cmd="cd /home/username/log"

u have typed aliase

I've now entered within the .profile :

alias logs="cd /home/username/log"

logout then relogin and typed logs and get the follwoing error :

logs: not found

Is there something else I'm missing from the .profile and I'm using shell sh

regards

you have to reload the profile.

. .profile

Should do the trick,

AlmostDaly

I have the same problem, and . .profile does not seem to work.

I found out my aliases do work if I leave a quote (') off the end of the last alias, but this causes my profile to not load properly.

Make this entry in your login script.

alias cls="clear"

log in script differs shell to shell. For example bash the log in script .bashrc and for ksh the log in script is .profile. So please verify what is your log in script and set the alias there.

ok. I put that line in .profile, because I'm using ksh, I log out and log back in, but I get this:

ksh:cls: not found

Is there a specific place in .profile I need to put it?

Please post the output from "alias" with no parameters after logging in. Maybe you have aliased "alias" itself.

The only thing having to do with alias is

hash='alias -t -'

and none of my aliases show up.

Clutching at straws: Can you post the output from this command which is to confirm exactly what is in the .profile file:

sed -n l .profile

$
$
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr\
/local/bin$
TMOUT=3600$
TIMEOUT=3600$
$
export PATH TMOUT TIMEOUT$
$
$
if [ -s "$MAIL" ] # This is at Shell startup. In normal$
then echo "$MAILMSG" # operation, the Shell checks$
fi # periodically.$
# If termdef command returns terminal type (i.e. a non NULL value),$
# set TERM to the returned value, else set TERM to default lft.$
TERM_DEFAULT=lft$
TERM=`termdef`$
TERM=${TERM:-$TERM_DEFAULT}$
MYHOST="`/usr/bin/hostname`"$
PS1='[$USER@$MYHOST] $PWD # '$
export TERM MYHOST PS1$
[ -x /usr/bin/ksh ] && exec ksh -o vi$

# aliases
alias cls='clear'$
. ./first.aliases$

No funny characters in the file. However nothing will more happen in .profile after the "exec" line because it starts a new shell.

The aliases you see came from ksh itself.

I can't see a simple way of setting more aliases in this context while retaining the "-o vi" option. The "-tx" switch to alias looks promising. No time to try it now.

Perhaps another poster in another timezone can help.