Skip to content

Commit

Permalink
Adding weather Script. Solving issue iiitl#2
Browse files Browse the repository at this point in the history
  • Loading branch information
aryamagarwal authored Mar 15, 2024
1 parent 96850b2 commit 9966f2b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions weather
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# TODO: Display weather of IIIT, Lucknow
# For more information see: https://wttr.in/:help
read -p "Enter name of the location: " in
# If user will enter name of the location with spaces we will convert it to required format
# /~Eiffel+tower # any location (+ for spaces)
old_IFS=IFS;
IFS=' '
read -ra array <<< "$in"
new="~"
for word in "${array[@]}"
do
new="${new}+${word}"
done
echo $(curl wttr.in/${new})
IFS=old_IFS

0 comments on commit 9966f2b

Please sign in to comment.