|
From: | Cristian Zoicas |
Subject: | difference in how ~ and HOME are treated when trying to remove a matching prefix. |
Date: | Tue, 2 Mar 2021 15:43:14 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.3 |
Hello all There is a difference in how ~ and HOME are treated when trying to remove a matching prefix. Here is an example: # ~ and $HOME are the same: # wj@rogers:~$ echo ~ /home/wj wj@rogers:~$ echo $HOME /home/wj # Nothing is removed (although the entire contents should be removed). # wj@rogers:~$ (A="/home/wj////"; echo "A (with prefix) : ${A}"; echo "A (without prefix): ${A##~*}") A (with prefix) : /home/wj//// A (without prefix): /home/wj//// # The prefix is removed with all following characters (due to *) # wj@rogers:~$ (A="/home/wj////"; echo "A (with prefix) : ${A}"; echo "A (without prefix): ${A##${HOME}*}") A (with prefix) : /home/wj//// A (without prefix): Is this a bug or am I missing something? Thank you Cristian
[Prev in Thread] | Current Thread | [Next in Thread] |