From 4ad5cf791d1c626be013485be1a2570d7e9316ef Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 6 Feb 2016 01:22:29 +1100 Subject: [PATCH] Fix weird behaviour with prin and --stdout --- fetch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fetch b/fetch index 4ac40438..6e57db5a 100755 --- a/fetch +++ b/fetch @@ -1235,7 +1235,7 @@ getbattery () { # If there's only a single battery and it's battery 0, # don't number the subtitle. if [ "${#batteries[@]}" == 1 ] && [ "$battery_num" == 0 ]; then - prin "${title}: ${batteries[0]}%" + battery="$(prin "${title}: ${batteries[0]}%")" return fi @@ -1858,10 +1858,11 @@ prin () { esac # Print the info - printf "%b%s" "${padding}${string}${clear}" - - # If stdout mode is off, print a newline too. - [ "$stdout" == "off" ] && printf "\n" + if [ "$stdout" == "on" ]; then + printf "%s" "${string}${stdout_seperator}" + else + printf "%b%s\n" "${padding}${string}${clear}" + fi } # }}}