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


Groups > gnu.bash.bug > #14218

Re: Bash don't interpret ~ path with multiple options.

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Bash don't interpret ~ path with multiple options.
Date Mon, 4 Jun 2018 08:33:12 -0400
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.1110.1528115628.1292.bug-bash@gnu.org> (permalink)
References <20180603020815.GA4907@supsup-VirtualBox> <50baa1ea-4503-20b6-adc4-9cf7e6395940@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1528115629 17598 208.118.235.17 (4 Jun 2018 12:33:49 GMT)
X-Complaints-To action@cs.stanford.edu
To Jungsub Shin <supsup5642@gmail.com>, bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
Mail-Followup-To Jungsub Shin <supsup5642@gmail.com>, bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <50baa1ea-4503-20b6-adc4-9cf7e6395940@case.edu>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14218

Show key headers only | View raw


On Sun, Jun 03, 2018 at 02:32:03PM -0400, Chet Ramey wrote:
> On 6/2/18 10:08 PM, Jungsub Shin wrote:
> > # mount -o remount,append=~/test_aufs/ro1=ro+wh ~/test_aufs/mount
> > 
> > mount failed with ~/test_aufs/ro1 path isn't exist message.
> > So i try to debug with strace and i find out bash don't replace ~
> > path to absolute path.

> Tilde expansion happens at the beginning of a word or after the `='
> and every `:' on the rhs of an assignment statement. Bash extends this to
> words that satisfy the criteria for assignment statements but appear as
> arguments to a command (so things like `export DIR=~/foo' work). The
> `remount,append=...' word does not satisfy the requirements for an
> assignment statement, since the characters before the `=' don't make up
> a valid shell identifier, so the tilde doesn't get expanded.

When in doubt, use "$HOME" instead of ~ to ensure that the expansion
will occur.

mount -o remount,append="$HOME"/test_aufs/ro1=ro+wh ~/test_aufs/mount

If you had been attempting to use ~user instead of ~ then I would
have recommended a temporary variable:

dir=~user/testaufs/ro1
mount -o remount,append="$dir"/test_aufs/ro1=ro+wh ~user/test_aufs/mount

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


Thread

Re: Bash don't interpret ~ path with multiple options. Greg Wooledge <wooledg@eeg.ccf.org> - 2018-06-04 08:33 -0400

csiph-web