create an alias

Posted on 1998-08-27
Last Modified: 2010-04-21
create an alias that would generate a command prompt that was in the following form:   ebarnes! - /etc>        where ebarnes is the current username, is the current hostname, and /etc is the current directory.  cant type info..must be system generated.
should use backquotes.
Question by:javajava082798
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 84

Expert Comment

ID: 2006811
which shell are you using?

Expert Comment

ID: 2006812
What is your operating system ?? Your default shell ? csh ? bash ? sh ? ksh ??

Is ebarnes@jupiter - /etc> prompt oki for you ? Or you'll need the whole domain name ? Which is very hard to get depending on
the OS.

Author Comment

ID: 2006813
working in csh  and need the whole domain
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.


Accepted Solution

cardell earned 200 total points
ID: 2006814
You could put the following in your .login file

set prompt="$USER\\!hostname` - `pwd`>"

That should do it.

Expert Comment

ID: 2006815
ooppss typo...

set prompt="$USER\\!`hostname` - `pwd`>"

also note that those are back tics around hostname and pwd not single quotes.

Expert Comment

ID: 2006816

This will only set the prompt correctly at login.  If the user changes directories then the prompt is no longer valid.  You would also have to alias the cd command to re-do the set each time it was executed.
LVL 51

Expert Comment

ID: 2006817
bchew is right, csh has no possibility to do this itself, you also must alias the cd,  pushd commands.
In tcsh you may use:
set prompt="$USER\\!`hostname` - %C%"

(assuming that hostname returns the fqdn)

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question