From 43f504e10196e97ced17ed4df3f93d6eed60cf4a Mon Sep 17 00:00:00 2001 From: James Tomasino Date: Thu, 12 Apr 2018 09:19:54 -0400 Subject: [PATCH] fixed issue with stat --- burrow | 114 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/burrow b/burrow index 4f55aed..255b967 100755 --- a/burrow +++ b/burrow @@ -132,7 +132,7 @@ parse_input () { "edit-config") arg_edit_config=1 ;; "update-git") arg_update_git=1 ;; "rss") arg_rss=1 ;; - *) printf "Unknown command: %s\n" "$arg";; + *) printf "Unknown command: %s\\n" "$arg";; esac done } @@ -152,7 +152,7 @@ update_gopher_root () { "$newdate" \ "$config_gopher_server" \ "$config_gopher_port") - sed -i'' "s|.*Last\ Updated:.*|${newString}|" "${config_dir_gopher}gophermap" + sed -i'' "s|.*Last\\ Updated:.*|${newString}|" "${config_dir_gopher}gophermap" } check_directory () { @@ -173,9 +173,9 @@ die () { # output message to stdout or stderr based on code if [ ! -z "$msg" ]; then if [ "$code" -eq 0 ]; then - printf "%s\n" "$msg" + printf "%s\\n" "$msg" else - printf "%s\n" "$msg" >&2 + printf "%s\\n" "$msg" >&2 fi fi exit "$code" @@ -232,7 +232,7 @@ make_post_gophermap () { if $use_gophermap; then if $use_date; then # if using gophermap and date - printf "1%s - %s\t%s\t%s\t%s\n" \ + printf "1%s - %s\\t%s\\t%s\\t%s\\n" \ "$(date +%Y-%m-%d)" \ "$title" \ "$post_file_path" \ @@ -240,7 +240,7 @@ make_post_gophermap () { "$config_gopher_port" > "$temp_gophermap" else # if using gophermap but not date - printf "1%s\t%s\t%s\t%s\n" \ + printf "1%s\\t%s\\t%s\\t%s\\n" \ "$title" \ "$post_file_path" \ "$config_gopher_server" \ @@ -249,7 +249,7 @@ make_post_gophermap () { else if $use_date; then # if not using gophermap but using date - printf "0%s - %s\t%s\t%s\t%s\n" \ + printf "0%s - %s\\t%s\\t%s\\t%s\\n" \ "$(date +%Y-%m-%d)" \ "$title" \ "$post_file_path" \ @@ -257,7 +257,7 @@ make_post_gophermap () { "$config_gopher_port" > "$temp_gophermap" else # if not using gophermap or date - printf "0%s\t%s\t%s\t%s\n" \ + printf "0%s\\t%s\\t%s\\t%s\\n" \ "$title" \ "$post_file_path" \ "$config_gopher_server" \ @@ -274,7 +274,7 @@ make_post_gophermap () { rm "$temp_gophermap" # Sort gophermap alphabetically if not using date - if [ "$use_gophermap" -a ! "$use_date" ]; then + if [ "$use_gophermap" ] && [ ! "$use_date" ]; then sort -fo "$type_gophermap" "$type_gophermap" fi } @@ -286,7 +286,7 @@ make_post_unprocess () { # If using gophermaps, unformat it for editing if $use_gophermap; then - awk -F"\t" '/^[0-9h\+GIThs].*\t/ {print $0; next} {sub(/^i/, "", $1);print $1}' "$post_file" > "${temp_post}" + awk -F"\\t" '/^[0-9h\+GIThs].*\t/ {print $0; next} {sub(/^i/, "", $1);print $1}' "$post_file" > "${temp_post}" else # copy existing post to tempfile cp "$post_file" "${temp_post}" @@ -321,11 +321,11 @@ make_post_temp () { cat "${post_dir}/.template" > "$temp_post" else { - printf "%s\n%s\n" "----------------------------------------" "$title" + printf "%s\\n%s\\n" "----------------------------------------" "$title" if $use_date; then date +"%B %d$(day_suffix), %Y" fi - printf "%s\n\n\n" "----------------------------------------" + printf "%s\\n\\n\\n" "----------------------------------------" } > "$temp_post" fi @@ -426,15 +426,15 @@ make_rss () { -mindepth 1 \ -type f \ -print | \ - grep -v "^\./gophermap$" | + grep -v "^\\./gophermap$" | sort -r | \ head -n "${config_rss_num_entries}") { - printf "\n" - printf "%s\n" "$config_gopher_name" - printf "gopher://%s%s\n" "$config_gopher_server" "$config_gopher_root" - printf "%s\n" "$config_gopher_desc" + printf '' + printf "\\n%s\\n" "$config_gopher_name" + printf "gopher://%s%s\\n" "$config_gopher_server" "$config_gopher_root" + printf "%s\\n" "$config_gopher_desc" } > "${config_dir_gopher}${config_file_rss}" for f in $search_list; do @@ -443,24 +443,24 @@ make_rss () { title="$(printf "%s" "$filename" | awk 'BEGIN { FS="-" } { $1=""; print $0; }' | sed "s|/gophermap||" | sed 's/^\ //' | sed 's/.*/\L&/; s/[a-z]*/\u&/g' )" { - printf "\n" - printf " %s\n" "$title" - printf " gopher://%s/0%s%s/%s\n" "$config_gopher_server" "$config_gopher_root" "$config_dir_phlog" "$filename" - printf " %s\n" "$(date -d "$date" +"%A, %d %b %Y %H:%M:%S %z" )" - printf " \n" + printf "\\n" + printf " %s\\n" "$title" + printf " gopher://%s/0%s%s/%s\\n" "$config_gopher_server" "$config_gopher_root" "$config_dir_phlog" "$filename" + printf " %s\\n" "$(date -d "$date" +"%A, %d %b %Y %H:%M:%S %z" )" + printf " \\n" if printf "%s" "$filename" | grep -q "gophermap$" then - awk -F"\t" '/^[2-9\+GITs].*\t/ {print $0; next} /^h.*\t/ { l=substr($1, 2, length($1)); print l "\n " substr($2, 5, length($2)); next } /^[0-1].*\t/ { l=substr($1, 2, length($1)); t=substr($1,1,1); print l "\n gopher://" $3 "/" t $2; next } {sub(/^i/, "", $1);print $1}' "$f" + awk -F"\\t" '/^[2-9\+GITs].*\t/ {print $0; next} /^h.*\t/ { l=substr($1, 2, length($1)); print l "\n " substr($2, 5, length($2)); next } /^[0-1].*\t/ { l=substr($1, 2, length($1)); t=substr($1,1,1); print l "\n gopher://" $3 "/" t $2; next } {sub(/^i/, "", $1);print $1}' "$f" else cat "$f" fi - printf "]]>\n" - printf "\n" + printf "]]>\\n" + printf "\\n" } >> "${config_dir_gopher}${config_file_rss}" done pop_d - printf "\n" >> "${config_dir_gopher}${config_file_rss}" - printf "\n" >> "${config_dir_gopher}${config_file_rss}" + printf "\\n" >> "${config_dir_gopher}${config_file_rss}" + printf "\\n" >> "${config_dir_gopher}${config_file_rss}" } edit_config () { @@ -483,37 +483,37 @@ create_config () { config="$HOME/.config/burrow/config" mkdir -p "$(dirname "$config")" { - printf "config_dir_gopher=\"%s/gopher/\"\n" "$HOME" - printf "\n" - printf "config_gopher_server=\"sdf.org\"\n" - printf "config_gopher_port=\"70\"\n" - printf "config_gopher_root=\"/users/username/\"\n" - printf "\n" - printf "config_dir_phlog=\"phlog\"\n" - printf "config_phlog_gophermap=true\n" - printf "config_phlog_usedate=true\n" - printf "config_phlog_autorss=false\n" - printf "\n" - printf "config_dir_recipebox=\"recipebox\"\n" - printf "config_recipebox_gophermap=false\n" - printf "config_recipebox_usedate=false\n" - printf "\n" - printf "config_dir_topics=\"topics\"\n" - printf "config_topics_gophermap=true\n" - printf "config_topics_usedate=false\n" - printf "\n" - printf "config_git_commit=false\n" - printf "config_git_push=false\n" - printf "\n" - printf "config_autoindent=true\n" - printf "\n" - printf "config_file_rss=\"rss.xml\"\n" - printf "config_gopher_name=\"My Gopher Hole\"\n" - printf "config_gopher_desc=\"Gopher Hole Description\"\n" - printf "config_rss_num_entries=\"10\"\n" + printf "config_dir_gopher=\"%s/gopher/\"\\n" "$HOME" + printf "\\n" + printf "config_gopher_server=\"sdf.org\"\\n" + printf "config_gopher_port=\"70\"\\n" + printf "config_gopher_root=\"/users/username/\"\\n" + printf "\\n" + printf "config_dir_phlog=\"phlog\"\\n" + printf "config_phlog_gophermap=true\\n" + printf "config_phlog_usedate=true\\n" + printf "config_phlog_autorss=false\\n" + printf "\\n" + printf "config_dir_recipebox=\"recipebox\"\\n" + printf "config_recipebox_gophermap=false\\n" + printf "config_recipebox_usedate=false\\n" + printf "\\n" + printf "config_dir_topics=\"topics\"\\n" + printf "config_topics_gophermap=true\\n" + printf "config_topics_usedate=false\\n" + printf "\\n" + printf "config_git_commit=false\\n" + printf "config_git_push=false\\n" + printf "\\n" + printf "config_autoindent=true\\n" + printf "\\n" + printf "config_file_rss=\"rss.xml\"\\n" + printf "config_gopher_name=\"My Gopher Hole\"\\n" + printf "config_gopher_desc=\"Gopher Hole Description\"\\n" + printf "config_rss_num_entries=\"10\"\\n" } >> "$config" else - printf "Configuration already exists.\n" + printf "Configuration already exists.\\n" fi } @@ -535,7 +535,7 @@ main () { fi if [ $flag_version -gt 0 ]; then - printf "%s\n" "$version" + printf "%s\\n" "$version" fi if [ $flag_help -gt 0 ]; then