formatting, quoting, & typo

This commit is contained in:
Emma Tebibyte 2024-01-16 12:52:26 -07:00
parent 6ea0433619
commit aba50c2843
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -1,9 +1,9 @@
#!/bin/sh
# defin the target dir
parent=$(dirname "${BASH_SOURCE[0]}")
cd $parent; cd ../../../
directory=$(pwd -P)
# define the target dir
parent="$(dirname "${BASH_SOURCE[0]}")"
cd "$parent"; cd ../../../
directory="$(pwd -P)"
today="$(date "+%Y-%m-%d")"
@ -11,25 +11,30 @@ printf "Date: %s\n" "$today"
for dirs in "$directory"/*; do
string="$(printf "---\n")"
area=$(basename "${dirs}")
area="$(basename "${dirs}")"
if [ "$area" != "System Volume Information" ]; then
string="$(printf "%stitle: %s\n" "$string" "$area")"
string="$(printf "%sdate: %s\n" "$string" "$today")"
string="$(printf "%s---\n\n" "$string")"
for cats in "$dirs"/*; do
category=$(basename "${cats}")
category="$(basename "$cats")"
string="$(printf "%s# %s\n\n" "$string" "$category")"
for ids in "$cats"/*; do
ident=$(basename "${ids}")
ident="$(basename "$ids")"
string="$(printf "%s* %s\n" "$string" "$ident")"
done
string="$(printf "%s\n" "$string")"
done
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
fname="${area:0:5}.md"
fullpath="$savedir$fname"
printf '%s\n' "$fullpath"
printf '%s' "$string" > "$fullpath"
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
fname="${area:0:5}.md"
fullpath="$savedir$fname"
printf '%s\n' "$fullpath"
printf '%s' "$string" > "$fullpath"
fi
done