#!/bin/sh TEMP=$(curl -s "wttr.in/Vienna?format=%c+%t\n") TEMP_ICON=$(echo -n $TEMP | cut -d+ -f1) TEMP_TEMP=$(echo -n $TEMP | cut -d+ -f2) ICON_LEN=$(printf $TEMP_ICON | wc -c) ICON_VAR=$(($ICON_LEN-3)) if [ $ICON_LEN -gt 4 ]; then TEMP_ICON=$(echo -n $TEMP | cut -b 1-$ICON_VAR) printf "%s %s" "$TEMP_ICON" "$TEMP_TEMP" else printf "%s%s" "$TEMP_ICON" "$TEMP_TEMP" fi