#!/bin/bash

#   Script:      apsk-equate-platzes
#
#
# by Apollia - http://apollia.com/
#
#
# 03:53:53 10/04/2021.  Before this update, last modified: 2017-07-28 21:52:27 -0400


if [ -z "$1" ]
then
	echo "$0: Arg #1 must be the platz you wish to equate other platz names to."
	
	
	#!!!!
	exit 1
fi


readonly Platz1="$1"

shift

# July 28, 2017, 1:30 PM.  Should valicheck the disknick to make sure
# it doesn't contain any path badchars or commas.

apsk-get-platz "$Platz1"  >/dev/null 2>&1
result_code="$?"

if [ "$result_code" != 0 ]
then
	echo "$0 error: Arg #1 - $Platz1 - was not a noted platz!"
	
	
	#!!!!
	exit 1
fi

for this_platz in "$@"
do
	path=$(apsk-get-platz "$this_platz")
		result_code="$?"
	
	if [ "$result_code" != 0 ]
	then
		
	fi
    echo "$var"
done


#echo "arg after that: $1"

readonly Platz_Path="$2"
# July 28, 2017, 1:46 PM.  Should valicheck to make sure it has no path badchars or commas.


readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
	readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script")

		readonly Follpath____Config="$Follpath____This_Script/0000-Config"

			readonly Fillepath____Folderpath_of_Platz_Notes="$Follpath____Config/Folderpath of Platz Notes"

				Follpath____Platz_Pathnotes=$(cat "$Fillepath____Folderpath_of_Platz_Notes")
					result_code="$?"

if [ "$result_code" != 0 ]
then
	echo
	echo
	echo "$0 error: Aborting, because it wasn't possible to retrieve the config file containing the folderpath of platz notes:

	$Fillepath____Folderpath_of_Platz_Notes"


	#!!!!
	exit 3
fi


if [ ! -d "$Follpath____Platz_Pathnotes" ]
then
	echo "not folder"
	mkdir --parents "$Follpath____Platz_Pathnotes"
		result_code="$?"
	
	
	if [ "$result_code" != 0 ]
	then
		echo
		echo
		echo "$0 error: Aborting, because somehow it wasn't possible to create this folder:
	
	$Follpath____Platz_Pathnotes"
		
		
		#!!!!
		exit 4
	
	fi
fi

readonly Fillepath____Platz_Note="$Follpath____Platz_Pathnotes/$Platz"

echo -n "$Platz_Path" > "$Fillepath____Platz_Note"