amazing. does something similar exist for ZSH?
Bash PS1 Generator
61–70 of 146 posts
Re: Bash PS1 Generator
#62I love the irony of using a GUI tool to create a prompt for a shell.
Re: Bash PS1 Generator
#63Re: Bash PS1 Generator
#64Earlier quoted context omitted.
While https is a good default, and LetsEncrypt has made it relatively trivial, I wouldn't say this particularly needs it; there isn't any user data at all. I suppose without TLS it could be intercepted and modified to return a malicious bash command, or something, but this random site on the internet could do that on its own without being intercepted anyway.
> I wouldn't say this particularly needs it; there isn't any user data at all. I use NoScript. This page requires me to enable JavaScript for it to work. Because it doesn't use TLS, this allows any miscreant in the middle to injected JS doing god-knows-what into my browser. If you really insist (in this case IMO understandable) on having me download and run your program, written in a turing complete scripting languag…
Re: Bash PS1 Generator
#65Am I the only one who leaves mine as is?
Re: Bash PS1 Generator
#66Normally I don't post much about how a site should use HTTPS on HN, but for this specific instance I think it's important.
One note: I hate snaps and don't use them personally, but it would make it very easy for you to add HTTPS without changing your existing stack.
Re: Bash PS1 Generator
#67On the site all prompt variables end in "tput sgr0". I haven't seen that before. What does that do and why is it needed?
tput query a terminfo database and return an escape code suitable for that $TERM. sgr0 is the name for "reset" (e.g. "\033[0;10m" in ANSI). Using tput instead of escape code directly is better in a lot of ways. For example, it allows the shell script to be adaptive to the type of TERM it runs on (e.g. not outputting color codes at all if TERM doesn't support colors). You can see what each tput commands are doing by r…
If your terminal ($TERM) is not known to the operating system, you can also import the terminfo definition from another OS in a directory and point the TERMINFO environment variable to it (useful if the legacy OS you connect to via SSH doesn't have full support for your fancy terminal emulator).
Re: Bash PS1 Generator
#68Am I the only one who leaves mine as is?
Try this to get the real default:
PS1='[\u@\h \W]\$ 'Re: Bash PS1 Generator
#69amazing. does something similar exist for ZSH?
https://github.com/spaceship-prompt/spaceship-prompt
Re: Bash PS1 Generator
#70On the site all prompt variables end in "tput sgr0". I haven't seen that before. What does that do and why is it needed?
It’s more efficient to echo CSI 0m, in shell than to run another process to do the same. Every mainstream terminal supports it.