Simple question: alias not working for root


 
Thread Tools Search this Thread
Operating Systems Solaris Simple question: alias not working for root
# 1  
Old 04-06-2011
Simple question: alias not working for root

OS = Solaris 8
Issue: alias not working for root, but working for regular users

Code:
# grep root /etc/passwd
root:x:0:1:Super-User:/:/sbin/sh

# alias dir=ls
# dir
dir: not found

# alias dir="ls -l"
# dir
dir: not found

# alias dir='ls -l'
# dir
dir: not found

# alias
autoload='typeset -fu'
command='command '
functions='typeset -f'
history='fc -l'
integer='typeset -i'
local=typeset
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='kill -STOP $$'

# alias dir=ls
# echo $#
0

Thanks.
# 2  
Old 04-06-2011
Just switch to /usr/xpg4/bin/sh, /bin/ksh or /bin/bash. /sbin/sh doesn't support aliases on Solaris 10 and older.
This User Gave Thanks to jlliagre For This Post:
# 3  
Old 04-07-2011
Yes. You are right. It's working now.

Thanks a lot, jlliagre Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Lost with this alias why it is not working

Hi, I have the following aliases: $: alias | grep "^du=" du='du -s * 2>/dev/null | awk '\''{ printf "%4.2f-KB ==> %s \n", $1/1024 , $2 }'\'' | sort -rn' $: alias | grep "^dutop10=" dutop10='du -s * 2>/dev/null | awk '\''{ printf "%4.2f-KB ==> %s \n", $1/1024 , $2 }'\'' | sort -rn | head... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

Alias not working

I have several shell scripts which contain the nawk command. Here is what i m doing assign the correct value to nawk as nawk is not found on a new systems. Here is what i did. more test.sh ] && alias nawk=/usr/bin/gawk ] && alias nawk=/usr/bin/nawk ] && alias nawk=/usr/bin/awk... (7 Replies)
Discussion started by: mohtashims
7 Replies

3. Shell Programming and Scripting

Simple .sh and alias or ? whatever. Do backup!

Hi , Using bash shell (mintty) in cygwin/windows env. for some time and having issues with most basic commands. Will be quite easy to get er done once I know how , just like magic tricks. I need either alias OR shell script to change windows to posix path AND put that line back -input OR .cd to... (2 Replies)
Discussion started by: sircuts
2 Replies

4. Solaris

Alias not working

Hi, I'm on Solaris (SunOS wsp2cm01 5.10 Generic_150400-10 sun4v sparc SUNW,Sun-Fire-T200). Trying to set up an alias like below - alias grep="/usr/xpg4/bin/grep"but when I call grep in my command it ignores my alias & uses /usr/bin/grep instead. The problem with /usr/bin/grep is that it doesn't... (24 Replies)
Discussion started by: nexional
24 Replies

5. Red Hat

[SOLVED] How the alias is working?

Iam facing some strange issue with alias. I have an alias file in which i have created lot of aliases as given below. export BUILD_HOME=/apps/psr/build export DB_HOME=/apps/psr/database export LOGS_HOME=/apps/psr/logs export BUILD_TEST=/apps/psr/build_dev/build_test export... (0 Replies)
Discussion started by: Vikram_Tanwar12
0 Replies

6. UNIX for Dummies Questions & Answers

cp command not working with alias

Hi Friends, I have added some aliases in .bash_profile file under the root folder. Its works fine and very useful, but does not go well with cp command. alias deploy="cd /usr/local/tomcat/webapp" alias artifacts="cd /usr/local/artifacts" but when i try to cp from artifacts folder... (2 Replies)
Discussion started by: prashdeep
2 Replies

7. UNIX for Dummies Questions & Answers

A very simple script, but alias won't work

I am new to unix and therefore I did a lot of reading before posting. So please, if this has been answered before, forgive me for re-posting and point me to the right place for the answer. I have spent many hours searching the net and read over 50 posts in this forum and even tried a few thing but... (20 Replies)
Discussion started by: sssccc
20 Replies

8. Solaris

Alias not working

Hello, I am trying to set an alias in my .kshrc or .profile and when I do it is not setting. If I do it manually it works fine. Is there another file I should put this in? Here is the alias I am using. alias ll='ls -ltr' I am using solaris 9. When I type alias it does not show these... (5 Replies)
Discussion started by: dkranes
5 Replies

9. Shell Programming and Scripting

alias a simple ls -l command

how do I alias the following command: ls -l |egrep 'drw|dr-|d--|d-w' The alias command needs single quotes and so does the above command, so this does not work: alias LSDIR 'ls -l |egrep 'drw|dr-|d--|d-w' ' My problem is how do I get a listing of only directories? Solaris 8 SUN Ultra 10... (4 Replies)
Discussion started by: ajp7701
4 Replies

10. Shell Programming and Scripting

Alias's & Functions - simple question

Having a memory lapse: If I redefine a command using an alias or a function - How do I access the "real" command without specifying an absoulte path: i.e. function man { /usr/bin/man |more } alias ls='/usr/bin/ls -l' How do I specify the ls or man command above without the... (6 Replies)
Discussion started by: kornshellmaven
6 Replies
Login or Register to Ask a Question