Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup a multiple line PS1, for zsh, but \n doesn't was parsed by zsh,

PS1="%~\n %> "

How should I set it up?

share|improve this question
PS1="firstline
secondline "

or

PS1=$'Hi Joe,\nwhat now?%# '

Taken from FAQ, item 3.13

share|improve this answer

Use $'\n'

For example,

PROMPT="firstline"$'\n'"secondline "

or

NEWLINE=$'\n'
PROMPT="firstline${NEWLINE}secondline "
share|improve this answer
    
Worked just like I needed it too. – Justin May 12 '15 at 17:09
1  
using NEWLINE makes it a lot easier to edit the prompt – cmcginty Dec 12 '15 at 3:20
    
What's the difference between PS1 and PROMPT variable? – Didier A. Feb 26 at 2:26

Like this (I know, looks awkward):

PS1="%~
 %> "
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.