Closed gfarrell closed 9 years ago
Same here, i think it has something to do width zsh shell, as when sourcing the file under bash it doesnt give the same error (OSX El Captain here)
It has something to do with "$()" command subtitution and embedded newlines. I was able to fix it by putting it all in one line. If resty doesn't work with stock zsh, then it should be fixed. I've got a few zsh modules loaded and am not sure if they're causing the problem. My "git diff" of resty:
diff --git a/resty b/resty
index 87fbed4..8fce400 100755
--- a/resty
+++ b/resty
@@ -29,8 +29,7 @@ function resty() {
host="$datadir/host"
cookies="$datadir/c"
method="$1"; [[ $# > 0 ]] && shift
- h2t=$((exec 2>&-; (which lynx >/dev/null && echo lynx -stdin -dump) \
- || which html2text || which cat) |tail -n 1)
+ h2t=$((exec 2>&-; (which lynx >/dev/null && echo lynx -stdin -dump) || which html2text || which cat) |tail -n 1)
editor=$((exec 2>&-; which "$EDITOR" || which vim || echo "vi") |tail -n 1)
[ "${method#P}" != "$method" ] || [ "$method" = "TRACE" ] && wantdata="yes"
@@ -82,11 +81,7 @@ function resty() {
[ -n "$dat" ] && opt="--data-binary"
[ "$method" = "HEAD" ] && opt="-I" && raw="yes"
[ -f "$confdir/$domain" ] && eval "args2=( $(cat "$confdir/$domain" 2>/dev/null |sed 's/^ *//' |grep ^$method |cut -b $((${#method}+2))-) )"
- res=$((((curl -sLv $opt "$dat" -X $method \
- -b "$cookies/$domain" -c "$cookies/$domain" \
- "${args2[@]}" "${curlopt2[@]}" "${curlopt[@]}" "$_path$query" \
- |sed 's/^/OUT /' && echo) 3>&2 2>&1 1>&3) \
- |sed 's/^/ERR /' && echo) 2>&1)
+ res=$((((curl -sLv $opt "$dat" -X $method -b "$cookies/$domain" -c "$cookies/$domain" "${args2[@]}" "${curlopt2[@]}" "${curlopt[@]}" "$_path$query" |sed 's/^/OUT /' && echo) 3>&2 2>&1 1>&3) |sed 's/^/ERR /' && echo) 2>&1)
out=$(echo "$res" |sed '/^OUT /s/^....//p; d')
err=$(echo "$res" |sed '/^ERR /s/^....//p; d')
ret=$(echo "$err" |sed \
Same