Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14451

Tilde expansion in assignment-like context

From Clint Hepner <clint.hepner@gmail.com>
Newsgroups gnu.bash.bug
Subject Tilde expansion in assignment-like context
Date 2018-08-06 15:09 -0400
Message-ID <mailman.4762.1533582607.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin16.7.0
Compiler: clang
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='d\
arwin16.7.0' -DCONF_MACHTYPE='x86_64-apple-darwin16.7.0' -DCONF_VENDOR='apple' \
-DLOCALEDIR='/usr/local/Cellar/bash/4.4.19/share/locale' -DPACKAGE='bash' -DSHE\
LL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib -I./lib/intl -I/priv\
ate/tmp/bash-20180209-55597-111ek7c/bash-4.4/lib/intl  -DSSH_SOURCE_BASHRC -Wno\
-parentheses -Wno-format-security
uname output: Darwin hemma.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 2\
1 20:07:39 PDT 2018; root:xnu-3789.73.14~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin16.7.0

Bash Version: 4.4
Patch Level: 19
Release Status: release

Description:
        A non-initial unquoted tilde is expanded outside of an assignment. This
        was raised as a question on Stack Overflow, https://stackoverflow.com/q/51713759/1126841.

Repeat-By:
        
        $ set +k
        $ echo home_dir=~
        home_dir=/Users/chepner

A similar string that does not start with a valid identifier leaves the tilde unexpanded.

        $ echo --home_dir=~
        --home_dir=~

The behavior is also present in commit 057a9fbdb4d9ad01b000743fcea9918b80823afc, bash-20180803 snapshot.


Fix:
        [Description of how to fix the problem.  If you don't know a
        fix for the problem, don't include this section.]

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Tilde expansion in assignment-like context Clint Hepner <clint.hepner@gmail.com> - 2018-08-06 15:09 -0400

csiph-web