diff options
author | Case Duckworth | 2020-05-23 19:46:22 -0500 |
---|---|---|
committer | Case Duckworth | 2020-05-23 19:46:22 -0500 |
commit | 185df06e7978fe1a159a726adf542fa38a8867b9 (patch) | |
tree | 84e26bed529d39dee84ee2b0a645faa42c17b225 | |
parent | Add usage() (diff) | |
download | bollux-185df06e7978fe1a159a726adf542fa38a8867b9.tar.gz bollux-185df06e7978fe1a159a726adf542fa38a8867b9.zip |
Fix redirecting issues
-rwxr-xr-x | bollux | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bollux b/bollux index b63e645..b9d1443 100755 --- a/bollux +++ b/bollux | |||
@@ -45,7 +45,7 @@ END_USAGE | |||
45 | 45 | ||
46 | ### utility functions ### | 46 | ### utility functions ### |
47 | # a better echo | 47 | # a better echo |
48 | put() { printf '%s\n' "$*" >&3; } | 48 | put() { printf '%s\n' "$*"; } |
49 | 49 | ||
50 | # conditionally log events to stderr | 50 | # conditionally log events to stderr |
51 | # lower = more important | 51 | # lower = more important |
@@ -91,7 +91,7 @@ die() { # die [EXIT-CODE] MESSAGE | |||
91 | ask() { # ask PROMPT [READ_OPT...] | 91 | ask() { # ask PROMPT [READ_OPT...] |
92 | prompt="$1" | 92 | prompt="$1" |
93 | shift | 93 | shift |
94 | read -e -r -u 3 -p "$prompt> " "$@" | 94 | read </dev/tty -e -r -p "$prompt> " "$@" |
95 | } | 95 | } |
96 | 96 | ||
97 | # fail if something isn't installed | 97 | # fail if something isn't installed |
@@ -271,8 +271,9 @@ download() { # download URL < FILE | |||
271 | 271 | ||
272 | ### main entry point ### | 272 | ### main entry point ### |
273 | bollux() { | 273 | bollux() { |
274 | # use &3 for user input | 274 | OPTIND=0 |
275 | exec 3<>/dev/tty | 275 | process_cmdline "$@" |
276 | shift $((OPTIND - 1)) | ||
276 | 277 | ||
277 | if (($# == 1)); then | 278 | if (($# == 1)); then |
278 | URL="$1" | 279 | URL="$1" |