小编jok*_*ker的帖子

此脚本中设置提示的时间戳在哪里?

我遇到了这篇旧帖子,我觉得它很有用。现在,我正在努力,但徒劳地告诉它的哪一部分负责在破折号末尾打印时间戳。

为方便参考,脚本如下:

# Fill with minuses
# (this is recalculated every time the prompt is shown in function prompt_command):
fill="—- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
command_style=$reset_style'\[\033[1;29m\]' # bold black

# Prompt variable:
PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\w\$'"$command_style "

# Reset color for command output
# (this one is invoked every time before a command is executed):
trap 'echo -ne "\e[0m"' DEBUG

function prompt_command {
    # create a $fill of all screen width minus the …
Run Code Online (Sandbox Code Playgroud)

command-line bash scripts prompt ps1

3
推荐指数
1
解决办法
234
查看次数

标签 统计

bash ×1

command-line ×1

prompt ×1

ps1 ×1

scripts ×1