You are not logged in.

#1 2013-02-07 03:50:50

Paruga
Member
From: Germany
Registered: 2013-02-07
Posts: 19
Website

Stuck on Zsh prompt

I'm really stuck. Harvesting my way through all the sources I've had the enlightened idea to make my prompt spit out a color that reflects about the owner of the current directory - such as green for owned, blue for foreign and red for root.

However - I dare not speak but cannot figure how to do that! --- I'd be glad to hear about suggestions where to look though.


---sometimes the obvious isn't there!--- | usermod -l root omnissiah

Offline

#2 2013-02-07 04:08:26

henk
Member
From: Weert, Netherlands
Registered: 2013-01-01
Posts: 334

Re: Stuck on Zsh prompt

https://wiki.archlinux.org/index.php/Color_Bash_Prompt

I don't want to be rude but
-the title of the thread doesn't reflect your real problem
-it took me 15 seconds to find this; you could probably find this on your own
-vets and moderators would tell you about the same; you must do your own research

Offline

#3 2013-02-07 04:12:41

doug piston
Member
From: Seattle
Registered: 2011-09-11
Posts: 387
Website

Re: Stuck on Zsh prompt

Might want to look at the ZSH wiki has some tips on your PS1 https://wiki.archlinux.org/index.php/Zs … our_prompt

Offline

#4 2013-02-07 05:16:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Stuck on Zsh prompt

If you search the Google for fancy zsh prompts, you will find that there are many absolutely ridiculous things you can do with a zsh prompt. I am be expert, but having read through a couple of those blog posts, what you are proposing is certainly possible and likely not too incredibly complicated.

Offline

#5 2013-02-09 01:15:51

pilotkeller
Member
From: Canada
Registered: 2011-12-22
Posts: 513
Website

Re: Stuck on Zsh prompt

Take a look at sed, ls, and the preprompt function.

Offline

#6 2013-02-19 17:46:43

Paruga
Member
From: Germany
Registered: 2013-02-07
Posts: 19
Website

Re: Stuck on Zsh prompt

What I figured out so far is to check whether I can read or write to the folder. So, currently I'm using that - plus that I'm using Asterisk's to color out access flags. What my vision implies is that I just get a colored line - which I got colored relative to the writable flag - to see more. I tend to play around with my filesystem a lot - and to see whether I own that folder or if it is just writable would make kindof an awesome treat. Anyhow - I got a bit further - but I can't figure it out.

What I'm using is [[ -w $PWD ]] - while here [http://zsh.sourceforge.net/Doc/Release/ … nsion.html] I read that this formula returns true if pwd is writable. Further down there is the s or f option which would return user specific information - but somehow it doesn't work out. I suppose that these are meant for something else - but I couldn't find anything else so far.


---sometimes the obvious isn't there!--- | usermod -l root omnissiah

Offline

Board footer

Powered by FluxBB