Timeline for Set PS1 based on the number of jobs
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 26, 2018 at 11:35 | comment | added | qeatzy | indeed, the function solution is cleaner. | |
| May 26, 2018 at 11:34 | comment | added | ilkkachu | So yeah, pretty much what that answer also does. Though with the 7-line case in there, I'd definitely put it in a function. | |
| May 26, 2018 at 11:33 | vote | accept | qeatzy | ||
| May 26, 2018 at 11:31 | comment | added | ilkkachu | @qeatzy, Bash runs whatever code there is in the PROMPT_COMMAND variable before printing each (primary) prompt. So you could set a variable there, and use it in PS1. E.g. something like PROMPT_COMMAND='((i += 3))'; PS1='$i \u@\h \w\$ ' (of course you can also call a function in PROMPT_COMMAND to make it cleaner) | |
| May 26, 2018 at 11:25 | comment | added | qeatzy | Many thx, really helpful. PROMPT_COMMAND? maybe similar to this (unix.stackexchange.com/a/217097/202329), though I cannot solve it currently. | |
| May 26, 2018 at 11:19 | history | edited | ilkkachu | CC BY-SA 4.0 | added 147 characters in body |
| May 26, 2018 at 11:13 | history | answered | ilkkachu | CC BY-SA 4.0 |