#! /bin/zsh weather () { local -a locs (( $# > 0 )) && locs=($@) || locs=(Uppsala,SE) local first=1 local data_string local -a data local l for l in $locs; do data_string=$(ansiweather -l "$l" -a false -s false) data=("${(@s/ /)data_string}") set-fg-color 5 echo -n ${(r:16:: :)data[5]} set-fg-color 6 echo -n $data[7] (( $first )) && echo "°C" && first=0 || echo reset-color done }