Date: Thu, 16 Dec 1999 08:08:13 -0800 From: "Duke Normandin" <01031149@3web.net> To: "Ryan Thompson" <freebsd@sasknow.com> Cc: "freebsd-questions" <freebsd-questions@FreeBSD.ORG> Subject: Re: csh prompt Message-ID: <004e01bf47e9$666dfee0$cd99c5d1@webserver>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?004e01bf47e9$666dfee0$cd99c5d1>