yanghn2002

View My GitHub Profile

POSIX Shell 定义了 PS1PS2PS4 三个可选的环境变量:2.5.3 Shell Variables

这里面最常见的是 PS1 它默认是一个 $ ,在用户准备输入的地方:

$ your command input here

通过定义 PS1 用户可以设置这个字符串:

export PS1=\(meow\)\ $\ 
(meow) $ echo hello
hello

PS2 是当用户输入不完整指令时换行时的提示符,默认是 >

export PS2=continue:\ 
(meow) $ if true
continue: then echo yes
continue: fi
yes

还有一个 PS4 ,它和 set -x 有关,很少用到了