[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

PS1 - Show me your promt

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 13
Thread images: 2

Show me your prompt, /g/. Post the source, shell, and any other details.

Bash 4.3.

export PROMPT_COMMAND=__prompt_command
function __prompt_command() {
local EXIT="$?"

local DEFAULT='\[\e[0m\]'

local RED='\[\e[0;31m\]'
local GREEN='\[\e[0;32m\]'
local DARK_GRAY='\[\e[0;90m\]'
local PURPLE='\[\e[0;35m\]'
local YELLOW='\[\e[0;33m\]'

PS1="\n${GREEN}\t${DEFAULT} "

if [ "$EXIT" != "0" ]; then
PS1+="${RED}$EXIT${DEFAULT} "
else
PS1+="$EXIT${DEFAULT} "
fi

JOBSCOUNT=$(jobs -p | wc -l)
if [ $JOBSCOUNT != "0" ]; then
PS1+="${YELLOW}$JOBSCOUNT${DEFAULT} "
fi


PS1+="${PURPLE}\w${DEFAULT}\n${DARK_GRAY}\u${DEFAULT}\\$ "
}
>>
>>55500705
Also, colors are Base 16 Monokai: https://chriskempson.github.io/base16/#monokai
>>
>>55500810
do you also wear a skirt?
>>
File: 2016-07-09-214522_527x68_scrot.png (9KB, 527x68px) Image search: [Google]
2016-07-09-214522_527x68_scrot.png
9KB, 527x68px
zsh.
~ λ echo $PS1
%{$fg[cyan]%}${PWD/#$HOME/~}%{$fg[magenta]%} λ %{$reset_color%}


>>55500705
>time in every single line
>>
>>55500897
I just added time recently, along with the blank line.

I first added it at work, where it is nice to be able to look at my sessions from yesterday and see when I started jobs, etc. I kinda like it, but I'm not completely sold yet.
>>
>>55500920
>>55500897
It's also useful as a "poor man's 'time'" on every command. I can go back and see how long something took to run, even if I didn't think to measure it the first time.
>>
am i a tard?
export PS1='[\u@\h \W]\$ '

maybe i ought to put the time in it and have colors but I don't want a super convoluted ps1
>>
>not having it do \b every line
why even have a speaker
>>
>>55500946
Nah, I used bare "$ " for a long time. Only add what you'll appreciate.
>>
>>55500975
i mean, colors look super nice, and having the time would be useful for when you're not in X
doing it rn
>>
can i have \A show the time in ISO 8601 (no separators)? muh tism demands it
>>
>>55501024
you know you can use any variable you want in PS1?
>>
>>55501024
>>55501094
You can also use PROMPT_COMMAND to build PS1 procedurally like I did in OP.
Thread posts: 13
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.