Alias does not work with bash profile


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Alias does not work with bash profile
# 1  
Old 11-08-2013
Alias does not work with bash profile

Hi,

Below is what i have in my profile:

Code:
alias wldm='cd /opt/app/wls'

If i use bash or ksh shell this alias does not work.
What should be done for this alias to work with all these simultaneously -> No Shell, bash shell, and ksh shell
# 2  
Old 11-08-2013
In bash, that alias does work, as long as there is a directory /opt/app/wls.

What do you mean by "No shell"? Aliases are innately bound to shells.
# 3  
Old 11-08-2013
where in your profile? How do you connect?

How do you expect an alias to work if there isnt a shell:
Quote:
What should be done for this alias to work with all these simultaneously -> No Shell, bash shell, and ksh shell
# 4  
Old 11-08-2013
After i login using

Code:
sudo su - user1

it works as below:

Code:
wldm

/opt/app/wls>

This is what i meant by no shell.

with bash and ksh shells it does not work as below

Code:
bash
bash-3.2$ wldm
bash: wldm: command not found
bash-3.2$ ksh
$ wldm
ksh: wldm:  not found

# 5  
Old 11-08-2013
How did you login in second example ?
# 6  
Old 11-08-2013
Quote:
Originally Posted by Peasant
How did you login in second example ?
The first and the second are not two different logins but they are single login.

This is what i am doing
Code:
Step 1: sudo su - user1
Step 2: wldm
Step 3: bash
Step 4: wldm
Step 5: ksh
Step 6: wldm

Step 2 works, Step 4 and 6 do not work as shown in the previous post.

Last edited by mohtashims; 11-08-2013 at 12:24 PM..
# 7  
Old 11-08-2013
If you do sudo su - user1
You read user1's environment ( his profile, but cat say which file since you did not tell us what user1 default shell is...)
Quote:
This is what i meant by no shell.
there is a shell! A new shell with user1 UID and profile...
So what I understand is user1 is set as you wish but not you... Is that the issue?

Sorry did not see your last post ( was writing this one hehe...) I will read it now...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

2. UNIX for Dummies Questions & Answers

Using alias to create subshell and work in it

using kerberos to access remote server. first I execute kshell to create subshell and then kinit username@domain in that subshell. After that it prompts to enter password. Since I need to do this over and over, I am trying creating alias. I tried kshell; kinit username@domain. Did not work,... (7 Replies)
Discussion started by: analyst
7 Replies

3. 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

4. Shell Programming and Scripting

Bash alias for complicated ls command does not work.

I'm trying to set up an alias in .bash_aliases to show just the filenames of the files in a directory, which the following command will do: ls -l | grep ^- | awk '{print $NF}' kjb.zip ap.zip tor.zip However when I set up the following alias in .bash_aliases: alias lf="ls -l | grep ^- |... (16 Replies)
Discussion started by: gencon
16 Replies

5. UNIX for Dummies Questions & Answers

alias command within .profile

Please could someone advise me the command - to set up aliases commands within a .profile using shell sh regards venhart (13 Replies)
Discussion started by: venhart
13 Replies

6. Shell Programming and Scripting

Global alias does not work in shell script

Hi Linux Set up - alias ls='ls -l' Then run script #! /bin/ksh sub() { ls } sub Is there any way to get it working. I don't want to define alias inside of the program Thank you (2 Replies)
Discussion started by: zam
2 Replies

7. OS X (Apple)

Problem using a top command alias in my profile

Hi- I am newish to the mac osx unix interface. I want to set up top so that it always displays the username. I can use this command to do this: top -ocpu -P ' PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE USER' -p '$aaaa ^bbbbbbbbb $cccc $wwwwwww $ee... (1 Reply)
Discussion started by: mikey11415
1 Replies

8. Shell Programming and Scripting

alias doesn't work

Hi I have put alias ll='ls -la' in .profile file but it doesn't work. On hand it works it looks like the .profile file is not beeing read. How to check whitch file is loaded? ,profile? .bash_profile? My system: SunOS mion 5.10 Generic Shell: /bin/pfksh Thanks (2 Replies)
Discussion started by: miojamo
2 Replies

9. UNIX for Advanced & Expert Users

All alias in .profile lost when "script" command is called

Hi, I was trying to call "script <an ip add>" command from .profile file to log everything whenever anyone logs in to this user. I did the following at the end of .profile. 1) Extracted the IP address who logged in 2) Called script < ip add> . The problem I am facing is all, aliases etc. written... (3 Replies)
Discussion started by: amicon007
3 Replies

10. UNIX for Dummies Questions & Answers

alias in .profile

hello guys... im just new in using unix and im trying to create a command by using an "alias" and incoporating it in my .profile. how can i make a command that will do a chmod 775 on all files only under my username. i tried alias gochmod="chmod 775 $PUROOT/path/*" but this gives me... (3 Replies)
Discussion started by: davinxi
3 Replies
Login or Register to Ask a Question