Home > database >  env: illegal option -- 0
env: illegal option -- 0

Time:09-17

I'm trying to use the command: env -0 but it give me this output:

env: illegal option -- 0
usage: env [-iv] [-P utilpath] [-S string] [-u name]
  [name=value ...] [utility [argument ...]]

Bash version: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)

OS: macOS Big Sur 11.6.8

How can I make the env command understand the -0 flag?

CodePudding user response:

You have options:

  • env | tr '\12' '\0'

    Pass newline separated env output through tr to change newlines to \0.

  • /opt/homebrew/Cellar/coreutils/9.1/libexec/gnubin/env
    Supply fill path to env.

  • Modify your PATH/path variable in any of these ~/.zshrc, ~/.bash_profile, ~/.cshrc, or ~/.login to the directory of genv.
    If you are unsure of where genv is installed, do this find /opt/homebrew /usr/local -name genv -print.

  • Related