X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=multipart.sh;h=7c0d5dd2da631cf9babe05726f678087c9c389c5;hb=696420310ff6a3ac680935ef50985f0d37c61ad9;hp=09e3ca8f256fd1bd598c9175150eb74aa78e7762;hpb=68261c373aa3e692cff9988f9d021aa0fa1783b6;p=shellwiki diff --git a/multipart.sh b/multipart.sh index 09e3ca8..7c0d5dd 100755 --- a/multipart.sh +++ b/multipart.sh @@ -53,8 +53,9 @@ multipart(){ ;; "${CR}") if [ $state = dheader ]; then - sed -n "/--${multipart_boundary}\(--\)\?${CR}/q; p;" \ - | head -c-2 + # Do not use `sed -n` (or busybox sed will "convert" NULL to LF) + sed "/--${multipart_boundary}\(--\)\?${CR}/{x;q;}" \ + | head -c-3 return 0; fi [ $state = header ] && state=junk