Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'tcsh prompt' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
tcsh prompt
Authored by: serversurfer on Dec 22, '01 04:24:31AM

Here's what I use.

set prompt="%S%P%s%n@%m%c03 %B%h%b%# "

This shows

2:29:07surfer@stella~ 6% cd /System/Library/Frameworks/LDAP.framework/Versions/A
2:29:08surfer@stella/<3>LDAP.framework/Versions/A 7%

The <3> represents the number of hidden directories. This is set with the %c03 section of the prompt definition. The 3 means show the last three elements of the path, and the leading 0 tells tcsh to show the number of hidden directories.
The 6 and 7 before my prompt is the history number of the command I'm about to execute. It's so you can easily recall a command later, but I don't really know how, I just thought it was cool.

There's also some color and highlighting commands in there that don't show up here. Also notice that I have a trailing space before the final quote in my prompt increase readability on the command line.
More info can be found if you 'man -c tcsh' then Apple-F for %c[[ (scroll back a bit to read the intro.)



[ Reply to This | # ]
tcsh prompt
Authored by: pmccann on Dec 22, '01 11:21:00AM

You mean you don't know how to recall these commands "down the track"? To get the command issued after the %6 prompt just enter

!6

any time in the current session and so forth. History is very nice, and even nicer if you "merge" the histories from all the different terminal windows that you have open. (Otherwise the most recently closed clobbers the existing .history file. Merging interleaves the commands with what's there already. There's a really nice article on daemonnews about tcsh (and csh) that explains a lot:

http://www.daemonnews.org/200112/csh_tcsh_part1.html

Well worth a read, and remembering to venture back for parts 2 and 3.

Regards,
Paul



[ Reply to This | # ]
Spiffy!
Authored by: serversurfer on Dec 23, '01 07:08:11PM

Thanks a lot! I was wondering how to recall these. I found the 'show history#' bit in the 'prompt' section of the tcsh man and , while I had no idea how to use it at the time, it seemed elite, and I figured I would come across the data eventually. ;)
I kind of like having separate histories for each shell, but my friend was just wishing he could merge them. I'll pass that link along to him, and offer his thanks in absentia.



[ Reply to This | # ]