z/OS Tools & Language

Expand all | Collapse all

Command output redirection scrambled under bash

  • 1.  Command output redirection scrambled under bash

    Posted 11-17-2017 13:50

    When I use back quotes or $(command) re-direct command output, the output is scrambled:

    $ date
    Fri Nov 17 12:41:35 EST 2017
    $ d=date; echo $d
    Æ@Õ¥@ñ÷@ñòzôñzõó@Åâã@òðñ÷

    I experimented with the following commands to no avail:
    export _TAG_REDIR_OUT=txt
    export _TAG_REDIR_OUT=txt



  • 2.  RE: Command output redirection scrambled under bash

    Posted 11-17-2017 17:02

    Can you please provide the output of:

    bash --version
    set
    env | sort
    

    I was unable to reproduce this problem.



  • 3.  RE: Command output redirection scrambled under bash

    Posted 11-22-2017 21:45

    $ bash --version
    GNU bash, version 4.3.46(51)-release (i370-ibm-openedition)
    Copyright © 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    $ set
    BASH=/usr/local/bin/bash
    BASHOPTS=cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
    BASH_ALIASES=()
    BASH_ARGC=()
    BASH_ARGV=()
    BASH_CMDS=()
    BASH_LINENO=()
    BASH_SOURCE=()
    BASH_VERSINFO=([0]=“4” [1]=“3” [2]=“46” [3]=“51” [4]=“release” [5]=“i370-ibm-openedition”)
    BASH_VERSION=‘4.3.46(51)-release’
    COLUMNS=80
    DIRSTACK=()
    ENV=/u/bstark/.kshrc
    EUID=990017
    GROUPS=()
    HISTFILE=/u/bstark/.bash_history
    HISTFILESIZE=500
    HISTSIZE=500
    HOME=/u/bstark
    HOSTNAME=mvsb
    HOSTTYPE=i370
    IFS=$’ \t\n’
    JAVA_HOME=/usr/lpp/java/J8.0
    LANG=C
    LIBPATH=/lib:/usr/lib:.
    LINES=24
    LOGNAME=BSTARK
    MACHTYPE=i370-ibm-openedition
    MAIL=/usr/mail/BSTARK
    MAILCHECK=60
    MANPATH=/usr/man/%L:/usr/local/man/
    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
    OPTERR=1
    OPTIND=1
    OSTYPE=openedition
    PATH=/bin:/usr/local/bin:/u/opsmvs/bin:/usr/lpp/java/J8.0/bin:.:/u/bstark/bin
    PIPESTATUS=([0]=“0”)
    PPID=65678
    PS1='S0W1:$PWD $ ‘
    PS2=’> ‘
    PS4=’+ '
    PWD=/u/bstark
    SHELL=/bin/sh
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
    SHLVL=1
    SSH_CLIENT='151.201.22.94 32807 22’
    SSH_CONNECTION='151.201.22.94 32807 10.1.10.198 22’
    SSH_TTY=/dev/ttyp0000
    STEPLIB=none
    TERM=xterm
    TZ=EST5EDT
    UID=990017
    USER=BSTARK
    _=–version

    $ env| sort
    ENV=/u/bstark/.kshrc
    HOME=/u/bstark
    JAVA_HOME=/usr/lpp/java/J8.0
    LANG=C
    LIBPATH=/lib:/usr/lib:.
    LOGNAME=BSTARK
    MAIL=/usr/mail/BSTARK
    MANPATH=/usr/man/%L:/usr/local/man/
    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
    PATH=/bin:/usr/local/bin:/u/opsmvs/bin:/usr/lpp/java/J8.0/bin:.:/u/bstark/bin
    PS1=S0W1:$PWD $
    PWD=/u/bstark
    SHELL=/bin/sh
    SHLVL=1
    SSH_CLIENT=151.201.22.94 32807 22
    SSH_CONNECTION=151.201.22.94 32807 10.1.10.198 22
    SSH_TTY=/dev/ttyp0000
    STEPLIB=none
    TERM=xterm
    TZ=EST5EDT
    USER=BSTARK
    _=/bin/env
    $



  • 4.  RE: Command output redirection scrambled under bash

    Posted 11-23-2017 02:50

    Hi,

    There is a file README.ZOS in the same place, where bash archive is located. It includes instruction about installation process. You have to set these environmental variables:

    export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
    export _BPXK_AUTOCVT=ON
    export _TAG_REDIR_ERR=txt
    export _TAG_REDIR_IN=txt
    export _TAG_REDIR_OUT=txt

    Please, add this lines into your configuration file (e.g., ~/.profile).



  • 5.  RE: Command output redirection scrambled under bash

    Posted 11-25-2017 11:37

    Thanks so much. That fixed my issue.
    I’m not finding much doc on those environment variables.



  • 6.  RE: Command output redirection scrambled under bash

    Posted 11-28-2017 12:43

    Here are some helpful links: