Beautifying the bash
This commit is contained in:
parent
e817c34644
commit
454d21b082
|
@ -4,7 +4,7 @@
|
|||
encrypt()
|
||||
{
|
||||
openssl enc -aes-256-cbc -salt -a -in $1 -out $2 || { echo "File not found"; exit 1; }
|
||||
echo "Successfully encrypted"
|
||||
echo "Successfully encrypted"
|
||||
}
|
||||
|
||||
decrypt()
|
||||
|
|
|
@ -49,9 +49,9 @@ printStockInformation()
|
|||
|
||||
getTicker()
|
||||
{
|
||||
response=$(curl -s "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=$1+$2+$3+$4+$5+$6+$7+$8+$9®ion=1&lang=en%22") > /dev/null
|
||||
symbol=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['ResultSet']['Result'][0]['symbol']")
|
||||
unset response
|
||||
response=$(curl -s "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=$1+$2+$3+$4+$5+$6+$7+$8+$9®ion=1&lang=en%22") > /dev/null
|
||||
symbol=$(echo $response | python -c "import sys, json; print json.load(sys.stdin)['ResultSet']['Result'][0]['symbol']")
|
||||
unset response
|
||||
}
|
||||
|
||||
checkInternet || exit 1
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
# Author: Alexander Epstein https://github.com/alexanderepstein
|
||||
getWeather()
|
||||
{
|
||||
country=$(curl -s ipinfo.io/country) > /dev/null
|
||||
if [ $country = "US" ];then
|
||||
city=$(curl -s ipinfo.io/city) > /dev/null
|
||||
region=$(curl -s ipinfo.io/region) > /dev/null
|
||||
region=$(echo "$region" | tr -dc '[:upper:]')
|
||||
curl wttr.in/$city,$region
|
||||
else
|
||||
location=$(curl -s ipinfo.io/loc) > /dev/null
|
||||
curl wttr.in/$location
|
||||
fi
|
||||
country=$(curl -s ipinfo.io/country) > /dev/null
|
||||
if [ $country = "US" ];then
|
||||
city=$(curl -s ipinfo.io/city) > /dev/null
|
||||
region=$(curl -s ipinfo.io/region) > /dev/null
|
||||
region=$(echo "$region" | tr -dc '[:upper:]')
|
||||
curl wttr.in/$city,$region
|
||||
else
|
||||
location=$(curl -s ipinfo.io/loc) > /dev/null
|
||||
curl wttr.in/$location
|
||||
fi
|
||||
}
|
||||
|
||||
checkInternet()
|
||||
|
|
Loading…
Reference in New Issue