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")"
|
||||
|
||||
echo -e "Date: $today\n"
|
||||
printf "Date: %s\n" "$today"
|
||||
|
||||
for dirs in "$directory"/*; do
|
||||
string="---\n"
|
||||
string="$(printf "---\n")"
|
||||
area=$(basename "${dirs}")
|
||||
if [ "$area" != "System Volume Information" ]; then
|
||||
|
||||
string+="title: $area\n"
|
||||
string+="date: $today\n"
|
||||
string+="---\n\n"
|
||||
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}")
|
||||
string+="# $category\n\n"
|
||||
string="$(printf "%s# %s\n\n" "$string" "$category")"
|
||||
for ids in "$cats"/*; do
|
||||
ident=$(basename "${ids}")
|
||||
string+="* $ident\n"
|
||||
string="$(printf "%s* %s\n" "$string" "$ident")"
|
||||
done
|
||||
string+="\n"
|
||||
string="$(printf "%s\n" "$string")"
|
||||
done
|
||||
savedir="$directory/00-09 Index/00 Index/00.01 Index/"
|
||||
fname="${area:0:5}.md"
|
||||
fullpath="$savedir$fname"
|
||||
echo $fullpath
|
||||
echo -e $string > "$fullpath"
|
||||
printf '%s\n' "$fullpath"
|
||||
printf '%s' "$string" > "$fullpath"
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user