This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
#!/usr/bin/perl use warnings; use strict; use utf8; use open OUT => ':encoding(UTF-8)', ':std'; use Term::ANSIColor; my %symbol = ( user => '\\u', hostname => colored('\\h', 'cyan'), pwd => '\\w', git_status => colored('$(echo OK)', 'green'), '|>' => '▶'); my $string = shift; my $re = join '|', map quotemeta, sort { length $b <=> length $a } keys %symbol; $string =~ s/($re)/$symbol{$1}/g; print $string;
另存为stript.pl,然后在bash中:
stript.pl
PS1=$(prompt.pl '|> user |> hostname |> pwd |> git_status |>')
Save as prompt.pl, then in bash:
prompt.pl
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
另存为
stript.pl
,然后在bash中:Save as
prompt.pl
, then in bash: