1
I've installed Cygwin under Windows 7 and I've added the line exec zsh -l
to C:\cygwin\home\Viktor\.bash_profile
.
Problem is I still get that ugly new line for every command I write:
(Viktor@INET)[2] ~
$ cd D:
(Viktor@INET)[3] /cygdrive/d
$ ls
$RECYCLE.BIN Program Files (x86) System Volume Information Viktor xampp
(Viktor@INET)[4] /cygdrive/d
$ _
As horizontal space is no concern with 1920 pixels I would like to have the "Linux appearance", something like this viktor@inet> _
or whatever is default. One command shouldn't take three lines. And how do I change the colors?
Edit. I also have Console2 installed, which I have set to use Cygwin, if that's any help.
I might have to brush up on my terminology then. ;) "Prompt" does ring a bell though. Anyway, great explanation and now I have something to go on: my googlings for "cygwin remove prefix line thingie" didn't return much. Which would be the ideal shell to use as a beginner? I downloaded zsh in hope that it would change the prompt to my liking (as I think I've used zsh or xterm in Ubuntu). Is bash a stand-alone shell? I thought I read that Cygwin uses mintty as default—is bash and mintty connected somehow? – Viktor – 2012-09-08T10:40:01.707
@Viktor: Both Bash and ZSH are "stand-alone", and both are good shells. Bash is the most popular and has a huge amount of tutorials on the web (not all of them are good, though), while ZSH is second (but more powerful and easier to customize – e.g. "grml-zsh" or "oh-my-zsh"). /// MinTTY is a terminal (similar to Xterm or Console2 or Win32 consoles) – it just displays program output on screen. You can run any shell inside it. – user1686 – 2012-09-08T10:59:55.677
Thanks a bunch! (I thought mintty was a shell as it was categorized under shells in the Cygwin package installer.) Anyways, I wrote a simple prompt variable which imitates the default terminal shell in the latest Ubuntu:
PROMPT = '%n@%M:%1~$ ' | tr 'A-Z' 'a-z'
. Although, my pipetr
does not seem to do anything. It's just an estetic change, but I would like to have it. That is, I want the wholePROMPT
to be lowercased. – Viktor – 2012-09-08T11:24:12.370@Viktor: Pipes and variables don't work that way. In your example, you are only running a command
PROMPT=...
(which sets a variable and does not output anything) and piping its output totr
. You aren't telling zsh to magically do the pipe every time it reads the value ofPROMPT
. /// If you want to have a lower-case hostname, try changing%M
→$(hostname|tr A-Z a-z)
. (You need to set PROMPT_SUBST for this to work.) – user1686 – 2012-09-08T11:46:28.953I have set
PROMPT_SUBST
, but I can't figure out how to use your code. How do I "map"hostname
to get its value from%M
? Right now I havePROMPT='%n@$(%M|tr A-Z a-z):%1~$ '
. I'm sorry, I have tried reading the documentation I could find, but it doesn't make sense for me. – Viktor – 2012-09-08T13:31:20.700@Viktor: You can't really do it with
%M
– you'll have to get the hostname from somewhere else, such as thehostname
command or the$HOSTNAME
variable. – user1686 – 2012-09-08T13:37:21.610Okay, so
PROMPT='$(whoami|tr A-Z a-z)@$(hostname|tr A-Z a-z):$(pwd|tr A-Z a-z)$ '
did the trick. Now I getviktor@inet:/home/viktor$
. Although I would like to just have the last directory, i.e.viktor@inet:subfolder$
orviktor@inet:~$
when in my home folder (whichviktor
is), but that's maybe too much to ask for? – Viktor – 2012-09-08T14:02:30.723basename
pwd``! – Viktor – 2012-09-08T14:15:25.667There, I'm satisfied for now: http://db.tt/tXLigPMr :)
– Viktor – 2012-09-08T14:38:23.487