On Tue, Mar 13, 2012 at 8:58 PM, Chet Ramey wrote:
> On 3/12/12 12:22 AM, Yongzhi Pan wrote:
> > Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
> >
> > Upon login, home dir is displayed as tilde in PS1:
> > pan@BJ-APN-2 ~$ echo $PS1
> > \[\033[35m\]\u@\h \w$ \[\033[0m\]
> >
On 03/13/2012 11:03 AM, dethrophes wrote:
>
> the missing "" in the case isn't redundant.
It is too redundant; you only need "" after case if the parser would
otherwise see two words before in.
> case "$HOME" in
>*[^/]* ) HOME=${HOME%${HOME##*[^/]}} ;;
>/ | // ) ;;
>*) HOME=/ ;; # //
Am 13.03.2012 18:13, schrieb Andreas Schwab:
dethrophes writes:
the missing "" in the case isn't redundant.
i.e. case "$HOME" in
The word is not subject to word splitting and filename expansion, so
there is no need to quote.
Andreas.
Ok thanks for clarifying that.
dethrophes writes:
> the missing "" in the case isn't redundant.
> i.e. case "$HOME" in
The word is not subject to word splitting and filename expansion, so
there is no need to quote.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 2
Am 13.03.2012 17:53, schrieb Eric Blake:
On 03/13/2012 09:47 AM, dethrophes wrote:
Am 13.03.2012 16:42, schrieb Eric Blake:
On 03/13/2012 09:27 AM, Eric Blake wrote:
Be aware that both approaches will misbehave if HOME is a root directory
(/ or //), where you _don't_ want to strip trailing sla
On 03/13/2012 09:47 AM, dethrophes wrote:
> Am 13.03.2012 16:42, schrieb Eric Blake:
>> On 03/13/2012 09:27 AM, Eric Blake wrote:
>>> Be aware that both approaches will misbehave if HOME is a root directory
>>> (/ or //), where you _don't_ want to strip trailing slashes. So you
>>> really want:
>>
Am 13.03.2012 16:42, schrieb Eric Blake:
On 03/13/2012 09:27 AM, Eric Blake wrote:
Be aware that both approaches will misbehave if HOME is a root directory
(/ or //), where you _don't_ want to strip trailing slashes. So you
really want:
case $HOME in
*[^/]* ) HOME=${HOME%${HOME##*[^/]}} ;;
On 03/13/2012 09:27 AM, Eric Blake wrote:
> Be aware that both approaches will misbehave if HOME is a root directory
> (/ or //), where you _don't_ want to strip trailing slashes. So you
> really want:
>
> case $HOME in
> *[^/]* ) HOME=${HOME%${HOME##*[^/]}} ;;
> esac
Actually, shortening ///
Am 13.03.2012 16:27, schrieb Eric Blake:
On 03/13/2012 09:18 AM, Roman Rakus wrote:
as a workaround to your problem you could have something like this in
your bashrc
if shopt extglob&>/dev/null ; then
HOME="${HOME/%+(\/)}" # strip all trailing forward slashes
else
while [ "${HOME}" !=
Am 13.03.2012 16:18, schrieb Roman Rakus:
On 03/13/2012 04:08 PM, dethrophes wrote:
Am 13.03.2012 06:04, schrieb Clark J. Wang:
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan
wrote:
Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
Upon login, home dir is displayed as tilde
On 03/13/2012 09:18 AM, Roman Rakus wrote:
>> as a workaround to your problem you could have something like this in
>> your bashrc
>> if shopt extglob &>/dev/null ; then
>> HOME="${HOME/%+(\/)}" # strip all trailing forward slashes
>> else
>>while [ "${HOME}" != "${HOME%\/}" ] ; do
>>
On 03/13/2012 04:08 PM, dethrophes wrote:
Am 13.03.2012 06:04, schrieb Clark J. Wang:
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote:
Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
Upon login, home dir is displayed as tilde in PS1:
pan@BJ-APN-2 ~$ echo $PS1
\[\033[35m
Am 13.03.2012 06:04, schrieb Clark J. Wang:
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote:
Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
Upon login, home dir is displayed as tilde in PS1:
pan@BJ-APN-2 ~$ echo $PS1
\[\033[35m\]\u@\h \w$ \[\033[0m\]
pan@BJ-APN-2 ~$ pwd
On 3/12/12 12:22 AM, Yongzhi Pan wrote:
> Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
>
> Upon login, home dir is displayed as tilde in PS1:
> pan@BJ-APN-2 ~$ echo $PS1
> \[\033[35m\]\u@\h \w$ \[\033[0m\]
> pan@BJ-APN-2 ~$ pwd
> /export/home/pan/
>
> After a cd command, w
On Mon, Mar 12, 2012 at 12:22, Yongzhi Pan wrote:
> Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
>
> Upon login, home dir is displayed as tilde in PS1:
> pan@BJ-APN-2 ~$ echo $PS1
> \[\033[35m\]\u@\h \w$ \[\033[0m\]
> pan@BJ-APN-2 ~$ pwd
> /export/home/pan/
>
> After a cd
Tested in GNU bash, version 3.00.16(1)-release and 4.1.2(1)-release.
Upon login, home dir is displayed as tilde in PS1:
pan@BJ-APN-2 ~$ echo $PS1
\[\033[35m\]\u@\h \w$ \[\033[0m\]
pan@BJ-APN-2 ~$ pwd
/export/home/pan/
After a cd command, which change directory to $HOME (not changed at all),
it is
16 matches
Mail list logo