From owner-freebsd-questions Sun May 28 9:30:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.inka.de (quechua.inka.de [212.227.14.2]) by hub.freebsd.org (Postfix) with ESMTP id 5701837B676 for ; Sun, 28 May 2000 09:30:46 -0700 (PDT) (envelope-from daemon@mips.inka.de) Received: from bigeye.mips.inka.de (uucp@) by mail.inka.de with local-bsmtp id 12w5xa-00033W-00; Sun, 28 May 2000 18:30:42 +0200 Received: (from daemon@localhost) by bigeye.mips.inka.de (8.9.3/8.9.3) id RAA23505 for freebsd-questions@freebsd.org; Sun, 28 May 2000 17:07:40 +0200 (CEST) (envelope-from daemon) From: naddy@mips.inka.de (Christian Weisgerber) Subject: Re: sh prompt Date: 28 May 2000 17:07:39 +0200 Message-ID: <8grcnr$mu8$1@bigeye.mips.inka.de> References: <8gqsgm$311u$1@bigeye.mips.inka.de> <20000528134732.CURV22611.mail.rdc1.va.home.com@john.baldwin.cx> To: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Baldwin wrote: > >> PS1="[$(tty | cut -c9-11)]:`whoami`.`hostname | sed 's/\..*//'`@"`pwd` > > You can get the prompt you want rather easily in tcsh using the following: > > set prompt='[%l]:%n.%m@%~\n%# ' That's actually not quite the same. %l gives all of the basename of the tty, rather than only the last two characters. Also, %/ would give the unsubstituted working directory like pwd does, although %~ is arguably preferable. BTW, your suggestion is PS1='[\l]:\u.\h@\w\n\$ ' in bash. Substitute ${PWD} for \w to get the unsubstituted directory. Getting the final two characters of the tty name requires some contortions, as it probably does in tcsh, e.g.: TTY=$(tty) PS1="[${TTY#/dev/tty}]:"'\u.\h@${PWD}\n\$ ' -- Christian "naddy" Weisgerber naddy@mips.inka.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message