Giter Site home page Giter Site logo

A question about bash pipe(|) about bashport HOT 2 OPEN

peiqingyu avatar peiqingyu commented on August 24, 2024
A question about bash pipe(|)

from bashport.

Comments (2)

IgorTodorovskiIBM avatar IgorTodorovskiIBM commented on August 24, 2024

Bash is compiled as an ASCII program, so in order to work with ebcdic files, you need to tag it appropriately.

If you tag your file as EBCDIC, using chtag -tc 1047 input do you get the expected result?

The other option is to set this environment variable:

  export     __UNTAGGED_READ_MODE=ASCII
              always convert data from CCSID 1047 to CCSID 819

from bashport.

peiqingyu avatar peiqingyu commented on August 24, 2024

The input is an ASCII file which is untagged and I expect to get its ASCII content in my Go program. In our actual case, the input file is a tarball and it is untagged. I expect the Go program to read the tarball in stdin and then extract the content correctly. I tested the following scenarios with bash:
$ cat tarball | go-program --- doesn't work
$ go-program < <(cat tarball) --- doesn't work
$ go-program <tarball --- works well
Only the third redirection method works for my case. Why the other two methods do not work? Is it possible to make them work? It seems the tarball is converted from 1047 to 819 by bash for the first two methods. Thanks.

from bashport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.