This repository was archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathalias-add
More file actions
60 lines (49 loc) · 1.32 KB
/
Copy pathalias-add
File metadata and controls
60 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#add alias to pat configure file
#20191129
LIST=$HOME/patmenu/ardop-list
CONFIG=$HOME/.wl2k/config.json
TEMP=$HOME/patmenu/tempalias.txt
TODAY=$(date +%Y%m%d-%R)
WHO=$(whoami)
source $HOME/patmenu/config
#backup config file
cp $CONFIG $CONFIG.$TODAY.bkup
clear;echo;echo;echo "Use this section to search for a new station to"
echo "add as an alias to your pat GUI"
echo;echo
read -p "What band would you like to search? 20,30,40,80 " BAND
FILE=$LIST/$BAND"mardoplist.txt"
read -p "What call sign would you like to search for? " CALL
RESULT=$(cat $FILE | grep -i $CALL)
if [ -z "$RESULT" ]
then
echo;echo;echo "Sorry, nothing matches your search"
sleep 3
exit 0
else
echo;echo "Here are the results of you search"
echo $RESULT
echo;echo;read -p "Would you like to add this station to your alias list? y/n " ANS
if [ $ANS == 'y' ] || [ $ANS == 'Y' ]
then
NAME=$(echo $RESULT | awk '{ print $1 }')
if [ $RIGCONTROL = 'yes' ]
then
SC=$(echo $RESULT | awk '{ print $11 }')
else
SC=$(echo $RESULT | awk '{ print $11 }' | sed 's/[?].*$//')
fi
FREQ=$(echo $SC | sed 's/.*=//')
jq '.connect_aliases += {'\""$NAME-$BAND"M"-$FREQ"\"' : '\"$SC\"'}' $CONFIG > $TEMP
cp $TEMP $CONFIG
rm $TEMP
sudo killall pat
sudo systemctl start pat@$WHO
echo "Your alias list has been updated"
else
echo;echo; "Nothing was modded"
sleep 2
exit 0
fi
fi