![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| please help me regarding alias | naree | Shell Programming and Scripting | 17 | 06-03-2008 01:14 AM |
| How to get the alias,when we have the IP. | preethgideon | UNIX for Dummies Questions & Answers | 2 | 07-24-2007 11:53 AM |
| alias help | shafique | UNIX for Dummies Questions & Answers | 5 | 10-03-2006 09:56 AM |
| using alias... | DebianJ | UNIX for Advanced & Expert Users | 2 | 05-12-2005 06:31 PM |
| Alias | guelpth | UNIX for Dummies Questions & Answers | 2 | 02-17-2005 04:29 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
alias
Hello,
I'm trying to create an alias that will show the path name of a current directory when a user cd's into any directory. I have tried the following: alias cd ' cd | pwd ' This just lists the current directory, even when I cd to another directory the alias just lists my home working directory. Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You are setting the alias cd to only cd back to your home directory...you aren't giving it the parameter of where to change to.
Try this instead - (will work with ksh and sh - not csh) set up PS1=`$PWD` in your .profile |
|
#3
|
|||
|
|||
|
thehoghunter:
Are you saying that I cannot create an alias within the csh to allow the user to know the cwd upon cd'ing? thanks |
|
#4
|
|||
|
|||
|
No, I wrote that the information given would not work with csh. If you know csh, you know it doesn't use .profile .
Put the following (or something like it) in your .cshrc alias cd 'cd \!*;set prompt="[`hostname`]$cwd :" ' Last edited by thehoghunter; 05-06-2002 at 10:41 AM. |
|
#5
|
|||
|
|||
|
csh ....
try use those lines on your .cshrc
set prompt = "[\!]$USER@`hostname`>" alias setprompt 'set prompt = "$USER@`hostname` $cwd>"' setprompt alias cd 'cd \!*;setprompt' alias pushd 'pushd \!*; setprompt' alias popd 'popd \!*; setprompt' alias pwd 'echo $cwd' Hope this help.
__________________
:rolleyes: |
|
#6
|
|||
|
|||
|
yellowfish, thehoghunter:
Thanks for the advice, I will give it a shot. I found another way of performing this task: alias cd 'get old = $ cwd; chdir \ !*; pwd' This works just fine. Again, thanks. |
|
#7
|
|||
|
|||
|
Hi,
I'm using ksh do you know how to make an alias for cd that will list all the files in the current directory? Cheers C19 |
|||
| Google The UNIX and Linux Forums |