Guest User

Untitled

a guest
Jun 21st, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.49 KB | None | 0 0
  1. # Prerequisite
  2.  
  3. It assumes you have `curl` installed in your system.
  4.  
  5. # Install
  6.  
  7. Create a file in users' home directory named `.weather`
  8.  
  9. ```
  10. touch ~/.weather
  11. ```
  12.  
  13. put the following code in the file-
  14.  
  15. ```
  16. #!/usr/bin/env bash
  17.  
  18. curl wttr.in/${1:-Münster}
  19. ```
  20.  
  21. Now change the permission of the file to executable.
  22.  
  23. ```
  24. sudo chmod +x ~/.weather
  25. ```
  26.  
  27. Now create an alias in your `.bashrc` or `.zshrc` file.
  28.  
  29. ```
  30. alias weather="sh ~/.weather"
  31. ```
  32.  
  33. # Uses
  34.  
  35. In the command line, just type `weather`. It will show the weather of Münster as mentioned in the .weather file.
  36. You can change it to your current location. If you want to see the weather of other location, just type `weather name_of_the_place`
  37. like `weather Dhaka`, it will show the weather of that place.
  38.  
  39. # Output Example
  40.  
  41. ```
  42. weather Münster
  43.  
  44. \ / Partly cloudy
  45. _ /"".-. 27 °C
  46. \_( ). ↗ 26 km/h
  47. /(___(__) 10 km
  48. 0.0 mm
  49. ┌─────────────┐
  50. ┌──────────────────────────────┬───────────────────────┤ Wed 20 Jun ├───────────────────────┬──────────────────────────────┐
  51. │ Morning │ Noon └──────┬──────┘ Evening │ Night │
  52. ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
  53. │ \ / Partly cloudy │ _`/"".-. Patchy rain po…│ \ / Partly cloudy │ \ / Partly cloudy │
  54. │ _ /"".-. 21 °C │ ,\_( ). 24-26 °C │ _ /"".-. 25-26 °C │ _ /"".-. 21 °C │
  55. │ \_( ). ↗ 13-16 km/h │ /(___(__) ↗ 15-17 km/h │ \_( ). → 14-21 km/h │ \_( ). → 12-24 km/h │
  56. │ /(___(__) 20 km │ ‘ ‘ ‘ ‘ 20 km │ /(___(__) 20 km │ /(___(__) 20 km │
  57. │ 0.1 mm | 58% │ ‘ ‘ ‘ ‘ 0.0 mm | 29% │ 0.0 mm | 0% │ 0.1 mm | 49% │
  58. └──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
  59. ┌─────────────┐
  60. ┌──────────────────────────────┬───────────────────────┤ Thu 21 Jun ├───────────────────────┬──────────────────────────────┐
  61. │ Morning │ Noon └──────┬──────┘ Evening │ Night │
  62. ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
  63. │ Overcast │ _`/"".-. Light rain sho…│ \ / Partly cloudy │ \ / Partly cloudy │
  64. │ .--. 16 °C │ ,\_( ). 17 °C │ _ /"".-. 13-15 °C │ _ /"".-. 9-12 °C │
  65. │ .-( ). → 27-35 km/h │ /(___(__) → 34-40 km/h │ \_( ). → 28-38 km/h │ \_( ). → 23-37 km/h │
  66. │ (___.__)__) 15 km │ ‘ ‘ ‘ ‘ 14 km │ /(___(__) 17 km │ /(___(__) 18 km │
  67. │ 0.4 mm | 61% │ ‘ ‘ ‘ ‘ 0.3 mm | 88% │ 0.0 mm | 0% │ 0.0 mm | 0% │
  68. └──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
  69. ┌─────────────┐
  70. ┌──────────────────────────────┬───────────────────────┤ Fri 22 Jun ├───────────────────────┬──────────────────────────────┐
  71. │ Morning │ Noon └──────┬──────┘ Evening │ Night │
  72. ├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
  73. │ Overcast │ _`/"".-. Light rain sho…│ _`/"".-. Patchy rain po…│ Cloudy │
  74. │ .--. 10-13 °C │ ,\_( ). 13-14 °C │ ,\_( ). 13-14 °C │ .--. 10-12 °C │
  75. │ .-( ). → 29-40 km/h │ /(___(__) → 26-35 km/h │ /(___(__) ↘ 23-32 km/h │ .-( ). → 19-30 km/h │
  76. │ (___.__)__) 15 km │ ‘ ‘ ‘ ‘ 14 km │ ‘ ‘ ‘ ‘ 14 km │ (___.__)__) 16 km │
  77. │ 0.5 mm | 55% │ ‘ ‘ ‘ ‘ 0.3 mm | 27% │ ‘ ‘ ‘ ‘ 0.2 mm | 27% │ 0.1 mm | 48% │
  78. └──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
  79. Location: Münster, Regierungsbezirk Münster, Nordrhein-Westfalen, Deutschland [51.9501317,7.61330165026]
  80.  
  81. New feature: multilingual location names wttr.in/станция+Восток (in UTF-8) and location search wttr.in/~Kilimanjaro (just add ~ before)
  82. Follow @igor_chubin for wttr.in updates
  83. ```
Add Comment
Please, Sign In to add comment