[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

env does not wrap variables that contain semicolon in quotes

From: Minghui Liu
Subject: env does not wrap variables that contain semicolon in quotes
Date: Fri, 20 Oct 2017 11:27:57 -0700

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
uname output: Linux pp772 4.9.41-moby #1 SMP Wed Sep 6 00:05:16 UTC 2017 x86_64 
x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

        If an environment variable has semicolon in it (for example, 
LS_COLORS), env output does not quote it. This cause problem when saving env 
output in a file and then source it later.

        1. Make sure you have an environment variable, such as LS_COLORS that 
has semicolon in it.
        2. Save env output in a file
                env > env_save
        3. Source the file just saved
                . env_save
        You should see bash complain because it got confused by the semicolons 
in the variable.

        Wrap environment variables that contain semicolons (or other characters 
that may confuse bash) using quotes in env output.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]