From ab468beb64a204d82761d5ba12f79a7cbbc1b450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 19 Oct 2020 21:28:49 +0200 Subject: [PATCH] Work better if $? is missing --- spp.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spp.pl b/spp.pl index bd7fec5..293a6b4 100644 --- a/spp.pl +++ b/spp.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl -# Shiny perl prompt, lol +# SHINY PERL PROMPT, lol +# Use with : export PROMPT_COMMAND='eval "$(perl path/to/spp.pl $?)"' use strict; use warnings; @@ -490,7 +491,7 @@ sub render_prevcmd my ( $ss , $sc , $pc , $cl ) = map { $CONFIG{ "pcmd_$_" } } qw( show_symbol show_code pad_code colors ); - my $status = $ARGV[0]; + my $status = scalar(@ARGV) ? $ARGV[0] : 255; $sc = ( $sc == 1 || ( $sc == 2 && $status ) ); return () unless $sc || $ss;