sophuwu.site > bashprompt
done a thing i guess lol
sophuwu sophie@sophuwu.site
Sat, 07 Oct 2023 22:33:45 +0200
commit

146b22437e1ff0fd273468c671828a13b565fb75

parent

0abbbbd38b97137fb10ebf2e3892c1f2650c33ab

2 files changed, 37 insertions(+), 0 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,3 +1,4 @@

.idea a.out build +pbin
M main.cppmain.cpp

@@ -0,0 +1,36 @@

+#include <cstdlib> +#include <string> + +int stoi(const std::string& str) { + int result = 0; + int mult = 1; + for (int i = 0; i < str.length(); i++) { + if (str[i] == '-') mult = -1; + else if (str[i] >= '0' && str[i] <= '9') result = result * 10 + mult*(str[i] - '0'); + } + return result; +} + +int main() { + + /*Bash prompt should: + - show current folder + - count how many commands were executed + - show random emoticon + - display in rainbow colors (choose rainbow length with env variable) + */ + + int bashline, rlenh, rlenv; + double i, r, g, b; + + int var; + int var2; + if(char* env = std::getenv("XSOPHCOUN")) var = stoi(env); + else var = 0; + if(char* env = std::getenv("")) var2 = stoi(env); + else var2 = 0; + + printf("export PS1=\"$SOPHVAR $HISTCMD:$LINENO\""); + + return 0; +}