On Fri, Sep 30, 2011 at 2:20 PM, Allan McRae <allan@archlinux.org> wrote:
On 30/09/11 15:23, lolilolicon wrote:
bsdtar -cf - $comp_files * | case "$PKGEXT" in - *tar.gz) gzip -c -f -n ;; - *tar.bz2) bzip2 -c -f ;; - *tar.xz) xz -c -z - ;; - *tar.Z) compress -c -f ;; - *tar) cat ;; + *tar.gz) gzip -c -f -n ;; + *tar.bz2) bzip2 -c -f ;; + *tar.xz) xz -c -z - ;; + *tar.Z) compress -c -f ;; + *tar) cat ;; + *) warning "$(gettext "'%s' is not a valid archive extension." <&-)" \ + "$PKGEXT" <&- >&2; cat ;;
I have no idea what all the <&- etc does here...
<&- closes stdin for the command. Not really needed, but explicitly ensures the stream piped from bsdtar is passed through to cat. For example $ echo a | { tr a A; cat; } A $ echo a | { tr a A <&-; cat; } tr: read error: Bad file descriptor a warning and gettext should not read the pipe, but explicitly closing their stdin doesn't hurt. At least, that's my theory...