echo(1) -> printf(1p): portability and nonstandard usage
This commit is contained in:
parent
07a41820ca
commit
6ea0433619
@ -7,29 +7,29 @@ directory=$(pwd -P)
|
|||||||
|
|
||||||
today="$(date "+%Y-%m-%d")"
|
today="$(date "+%Y-%m-%d")"
|
||||||
|
|
||||||
echo -e "Date: $today\n"
|
printf "Date: %s\n" "$today"
|
||||||
|
|
||||||
for dirs in "$directory"/*; do
|
for dirs in "$directory"/*; do
|
||||||
string="---\n"
|
string="$(printf "---\n")"
|
||||||
area=$(basename "${dirs}")
|
area=$(basename "${dirs}")
|
||||||
if [ "$area" != "System Volume Information" ]; then
|
if [ "$area" != "System Volume Information" ]; then
|
||||||
|
|
||||||
string+="title: $area\n"
|
string="$(printf "%stitle: %s\n" "$string" "$area")"
|
||||||
string+="date: $today\n"
|
string="$(printf "%sdate: %s\n" "$string" "$today")"
|
||||||
string+="---\n\n"
|
string="$(printf "%s---\n\n" "$string")"
|
||||||
for cats in "$dirs"/*; do
|
for cats in "$dirs"/*; do
|
||||||
category=$(basename "${cats}")
|
category=$(basename "${cats}")
|
||||||
string+="# $category\n\n"
|
string="$(printf "%s# %s\n\n" "$string" "$category")"
|
||||||
for ids in "$cats"/*; do
|
for ids in "$cats"/*; do
|
||||||
ident=$(basename "${ids}")
|
ident=$(basename "${ids}")
|
||||||
string+="* $ident\n"
|
string="$(printf "%s* %s\n" "$string" "$ident")"
|
||||||
done
|
done
|
||||||
string+="\n"
|
string="$(printf "%s\n" "$string")"
|
||||||
done
|
done
|
||||||
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
|
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
|
||||||
fname="${area:0:5}.md"
|
fname="${area:0:5}.md"
|
||||||
fullpath="$savedir$fname"
|
fullpath="$savedir$fname"
|
||||||
echo $fullpath
|
printf '%s\n' "$fullpath"
|
||||||
echo -e $string > "$fullpath"
|
printf '%s' "$string" > "$fullpath"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user