mirror of
https://github.com/Llewellynvdm/CoinRate.git
synced 2024-11-24 03:27:34 +00:00
Adapted the commands (IMPORTANT-Take Note) to more fitting
This commit is contained in:
parent
99ad958c42
commit
c8fdc4e1b7
28
getPrice.sh
28
getPrice.sh
@ -28,8 +28,8 @@ VDMHOME=~/
|
|||||||
|
|
||||||
# main function
|
# main function
|
||||||
function main () {
|
function main () {
|
||||||
echo "................................................................................................"
|
echo ".................................[ Vast Development Method ]...................................."
|
||||||
echo "...==========================================================================================..."
|
echo "...========================================================================| www.vdm.io |====..."
|
||||||
echoTweak "Getting the current price of $Currency in $Target"
|
echoTweak "Getting the current price of $Currency in $Target"
|
||||||
echo "...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..."
|
echo "...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~..."
|
||||||
# get the price value
|
# get the price value
|
||||||
@ -310,10 +310,12 @@ AboveValue=0
|
|||||||
Telegram=0
|
Telegram=0
|
||||||
LinuxNotice=0
|
LinuxNotice=0
|
||||||
SMS=0
|
SMS=0
|
||||||
|
|
||||||
|
# Some paths
|
||||||
API="https://cex.io/api/last_price/"
|
API="https://cex.io/api/last_price/"
|
||||||
VDMHOME=~/
|
VDMHOME=~/
|
||||||
|
|
||||||
# set some arrays
|
# Some arrays
|
||||||
declare -A aboveMessages
|
declare -A aboveMessages
|
||||||
declare -A belowMessages
|
declare -A belowMessages
|
||||||
Messages=()
|
Messages=()
|
||||||
@ -322,16 +324,16 @@ Messages=()
|
|||||||
Datetimenow=$(TZ=":ZULU" date +"%m/%d/%Y @ %R (UTC)" )
|
Datetimenow=$(TZ=":ZULU" date +"%m/%d/%Y @ %R (UTC)" )
|
||||||
|
|
||||||
# Help display function
|
# Help display function
|
||||||
function send_help {
|
function show_help {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: ${0##*/:-} [OPTION...]
|
Usage: ${0##*/:-} [OPTION...]
|
||||||
Getting Coin Value in Fiat Currency at set price
|
Getting Coin Value in Fiat Currency at set price
|
||||||
|
|
||||||
-c Currency to watch (c:_)
|
-c Currency to watch (c:_)
|
||||||
example: BTC
|
example: BTC
|
||||||
-t Target Currecy to Display (_:t)
|
-C Target Currecy to Display (_:t)
|
||||||
example: USD
|
example: USD
|
||||||
-s The cycle of time to follow
|
-h How often should the message be send/shown
|
||||||
0 = once per/day (default)
|
0 = once per/day (default)
|
||||||
1 = once per/hour
|
1 = once per/hour
|
||||||
2 = everyTime
|
2 = everyTime
|
||||||
@ -344,8 +346,8 @@ Getting Coin Value in Fiat Currency at set price
|
|||||||
example: 14000 or 14000,15000
|
example: 14000 or 14000,15000
|
||||||
-b Send Notice below target value once a day
|
-b Send Notice below target value once a day
|
||||||
-a Send Notice above target value once a day (default)
|
-a Send Notice above target value once a day (default)
|
||||||
-n Send A Telegram Notice aswell (always sends comandline Notice)
|
-t Send A Telegram Notice aswell (always sends comandline Notice)
|
||||||
-m Send A SMS Notice aswell (always shows comandline Notice)
|
-s Send A SMS Notice aswell (always shows comandline Notice)
|
||||||
-l Show A Linux Notice aswell (always shows comandline Notice)
|
-l Show A Linux Notice aswell (always shows comandline Notice)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -357,15 +359,15 @@ exit 1
|
|||||||
# http://mywiki.wooledge.org/BashFAQ/035
|
# http://mywiki.wooledge.org/BashFAQ/035
|
||||||
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
||||||
|
|
||||||
while getopts ":c:t:s:v:A:B:b :a :n :m :l :" opt; do
|
while getopts ":c:C:h:v:A:B:b :a :t :s :l :" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
c)
|
c)
|
||||||
Currency=$OPTARG
|
Currency=$OPTARG
|
||||||
;;
|
;;
|
||||||
t)
|
C)
|
||||||
Target=$OPTARG
|
Target=$OPTARG
|
||||||
;;
|
;;
|
||||||
s)
|
h)
|
||||||
sendSwitch=$OPTARG
|
sendSwitch=$OPTARG
|
||||||
;;
|
;;
|
||||||
v)
|
v)
|
||||||
@ -383,10 +385,10 @@ while getopts ":c:t:s:v:A:B:b :a :n :m :l :" opt; do
|
|||||||
a)
|
a)
|
||||||
AboveValue=1
|
AboveValue=1
|
||||||
;;
|
;;
|
||||||
n)
|
t)
|
||||||
Telegram=1
|
Telegram=1
|
||||||
;;
|
;;
|
||||||
m)
|
s)
|
||||||
SMS=1
|
SMS=1
|
||||||
;;
|
;;
|
||||||
l)
|
l)
|
||||||
|
Loading…
Reference in New Issue
Block a user