Im trying to set up my shell prompt so that it shows the hostname followed by some directory info. I usually do it as follows -
PS1="(`uname -n`:$parent/$this) " where $parent and $this are previously set to be the parent dir and working dir. THis works good, except on systems where the $HOSTNAME is set to be the fully qualified name, eg host.domain1.domain2.com ... because on these systems the prompt is just too long (i dont have permission to change the hostname definition). For example, on one of these systems, the above prompt definition will expand to be something like ... (host.domain1.domain2.com:/parent_dir/this_dir) But, I really want it to be just ... (host:/parent_dir/this_dir) SO, does anyone know how I could set up the prompt on these systems so that it uses *only* the hostname? In other words, if Im on a system where the hostname is set to be the fully qualified dns name, how can I extract *just* the hostname itself and assign it to the PS1? (so it looks like the second example above) I hope this makes sense. --Justin.
