From owner-freebsd-questions Thu Dec 16 8:15:35 1999 Delivered-To: freebsd-questions@freebsd.org Received: from smtp1.cybersurf.net (smtp1.cybersurf.net [209.197.145.111]) by hub.freebsd.org (Postfix) with ESMTP id 5680A14F51 for ; Thu, 16 Dec 1999 08:15:30 -0800 (PST) (envelope-from 01031149@3web.net) Received: from webserver ([209.197.153.205]) by smtp1.cybersurf.net (Netscape Messaging Server 4.05) with SMTP id FMUD7K00.RMJ; Thu, 16 Dec 1999 09:16:32 -0700 Message-ID: <004e01bf47e9$666dfee0$cd99c5d1@webserver> From: "Duke Normandin" <01031149@3web.net> To: "Ryan Thompson" Cc: "freebsd-questions" Subject: Re: csh prompt Date: Thu, 16 Dec 1999 08:08:13 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3612.1700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Ryan.... |> I've been reading a Linux shell tutorial and the man pages. ;) |> Searched the mailing list for, and found examples of, prompts with |> various shells. |> |> In my ~/.cshrc file: |> |> set prompt = "' hostname -s'# " |> |> works. | |It shouldn't work! Are you sure you typed the above correctly? See |below. | | |> Why doesn't the following? |> |> set prompt = "'whoami'@'hostname -s':$cwd# " |> |> I keep getting for example: |> |> 'whoami'@'hostname':/etc# _ | |You're getting the exec elements spelled out (whoami and hostname) because |you've used the wrong quotation marks. When you want to exec something in |this fashion, you need to use "backticks" ( ` ). So, instead of |'whoami', you should use `whoami`. S.O.B!!!! I suppose that's the trouble with scooping inaccurate examples from the mailing list archives. I copied them verbatim - spaces and all. I was beginning to think that I was dummer than a "bag-full" of hammers" ;) I'll never forget about this "backtick" thing! Of course, it's possible that I misinterpreted one for the other ;) So I settled for: set prompt = "$user@$cwd# " just to get some semblance of a decent prompt. |AND, you've also hit on another important point with your use of $cwd. |Since your prompt is set in your .cshrc file, it is set only when you log |in, and is not changed after each command. Therefore, if you ran your |.cshrc script while you were in /etc, your prompt is always going to say |/etc. :-) | |Try the following instead (this is actually very similar to what I use): | |set prompt = "`whoami`@`hostname -s`:`pwd`# " | |alias cd 'cd \!* ; set prompt = "`whoami`@`hostname -s`:`pwd`# "' |alias pushd 'cd \!* ; set prompt = "`whoami`@`hostname -s`:`pwd`# "' |alias popd 'popd ; set prompt = "`whoami`@`hostname -s`:`pwd`# "' | |You may not use pushd and popd (yet), but they've been included for |completeness. Suffice to say, everytime you change directories with cd, |pushd, or popd, your prompt will be refreshed. Yep...done that! With the above compromise prompt!! Works well! |For user accounts, you may want to replace the # with a $ to differentiate |between userland and the super user. (# is usually reserved for the |elite, and represents a true symbol of power :-) I'll be dodging checkstops in my electrical wheelchair and slugging back "Geritol" hourly before I garner enough savvy to even approach the elite ranks :^) -- or so it seems! Appreciated the input..............duke To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message