Edit Install/Uninstall scripts; Update README.md
Edited Install and Uninstall scripts to handle both at_telnet_daemon and simpleadmin
This commit is contained in:
22
simpleadmin/scripts/tojson.sh
Normal file
22
simpleadmin/scripts/tojson.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# sarav (hello@grity.com)
|
||||
# convert key=value to json
|
||||
# Created at Gritfy ( Devops Junction )
|
||||
#
|
||||
|
||||
file_name=$1
|
||||
last_line=$(wc -l < $file_name)
|
||||
current_line=0
|
||||
|
||||
echo "{"
|
||||
while read line
|
||||
do
|
||||
current_line=$(($current_line + 1))
|
||||
if [[ $current_line -ne $last_line ]]; then
|
||||
[ -z "$line" ] && continue
|
||||
echo $line|awk -F'=' '{ print " \""$1"\" : "$2","}'|grep -iv '\"#'
|
||||
else
|
||||
echo $line|awk -F'=' '{ print " \""$1"\" : "$2""}'|grep -iv '\"#'
|
||||
fi
|
||||
done < $file_name
|
||||
echo "}"
|
||||
Reference in New Issue
Block a user