Skip to content

Commit

Permalink
Merge pull request #32 from fantattitude/master
Browse files Browse the repository at this point in the history
Current_condition is now properly checked on OS X (PCRE Grep not supported on OS X)
  • Loading branch information
tor-oscar committed Jul 28, 2012
2 parents 490e8ab + fac12ab commit 4b14bb7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion segments/weather.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ if [ -z "$degrees" ]; then
exit 1
fi
degrees=$(echo "$weather_data" | sed "s|.*<temp_${search_unit} data=\"\([^\"]*\)\"/>.*|\1|")
conditions=$(echo "$weather_data" | grep -PZo "<current_conditions>(\\n|.)*</current_conditions>" | grep -PZo "(?<=<condition\sdata=\")([^\"]*)")
if [ "$PLATFORM" == "mac" ]; then
conditions=$(echo "$weather_data" | grep -EZo "<current_conditions>(\\n|.)*</current_conditions>" | grep -EZo '<condition data="([a-zA-Z ]*)"/>' | sed -n 's/^.*\"\([a-zA-Z ]*\)\".*/\1/p')
else
conditions=$(echo "$weather_data" | grep -PZo "<current_conditions>(\\n|.)*</current_conditions>" | grep -PZo "(?<=<condition\sdata=\")([^\"]*)")
fi
echo "$degrees" > $tmp_file
echo "$conditions" >> $tmp_file
elif [ -f "$tmp_file" ]; then
Expand Down

1 comment on commit 4b14bb7

@tommyolofsson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled this from original author. Depleted resources - got loads of 'unable to fork' and 'too many open files'. Fucked. Shit. Up. (osx lion)

Please sign in to comment.