From 3ede734129c951d15695fb80f4ad9dc5031ac72d Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 29 Jun 2020 13:42:53 +0800 Subject: Feed STDIN only to function tac --- gist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gist b/gist index a0ee803..44358dc 100755 --- a/gist +++ b/gist @@ -90,7 +90,7 @@ tmp_file() { mktemp -p $tmp_dir -t $1.XXXXXX fi } -tac() { sed -e '1! G; h; $!d' $1; } # An easy way to reverse file content both on Linux and Darwin +tac() { sed -e '1! G; h; $!d'; } # An easy way to reverse file content both on Linux and Darwin mtime() { if [[ $(uname) == Darwin ]]; then stat -x $1 | grep Modify | cut -d' ' -f2- @@ -432,7 +432,7 @@ _update_gists() { extra="s0 True b0d2e7e67aa50298fdf8111ae7466b56 #bash,#gist NONE README.md@Markdown,gist@Shell 2 30 typebrook 2019-12-26T06:49:40Z 2020-05-15T13:00:31Z [bash-gist] A bash script for gist management" [[ $mark == s ]] && echo $extra >> $INDEX - tac $fetched_records | nl -s' ' \ + tac <$fetched_records | nl -s' ' \ | while read -r "${INDEX_FORMAT[@]:0:2}" extra; do local prefix='' [[ $public == False ]] && prefix=p; [[ $mark == s ]] && prefix=s @@ -448,7 +448,7 @@ _update_gists() { _query_user() { local fetched_records=$(tmp_file fetched) route=users/$1/gists _fetch_gists_with_pagnation $fetched_records - tac $fetched_records | nl -s' ' \ + tac <$fetched_records | nl -s' ' \ | while read -r ${INDEX_FORMAT[@]}; do echo $index ${GIST_DOMAIN}/${gist_id} $author $file_num $comment_num $description | cut -c -"$(tput cols)" done || { echo "Failed to query $1's gists"; exit 1; } -- cgit v1.2.3-70-g09d2