bug-bash
[Top][All Lists]
Advanced

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

command substitution fails with PS1 and multiline in one case


From: EmanueL Czirai
Subject: command substitution fails with PS1 and multiline in one case
Date: Sun, 03 Aug 2014 01:27:06 +0200

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-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib
-D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe
-fstack-protector-strong --param=ssp-buffer-size=4
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux manji 3.16.0-rc7-MANJAROed #1 SMP Sat Aug 2 21:37:56
CEST 2014 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 18
Release Status: release

Description:
Getting a syntax error where it shouldn't happen, I believe.
This seems to happen only with PS1.

the error is like this:
bash: command substitution: line 1: syntax error near `date)'
bash: command substitution: line 1: `date)'
exit

Repeat-By:
1. start a bash shell
2. put this in .bashrc

PS1='$(date)\
'

put no spaces after \
the entire thing is 2 lines - may add new line after ' though, and prior to PS1

3. start a new bash
the error is:
bash: command substitution: line 1: syntax error near `date)'
bash: command substitution: line 1: `date)'
exit
and the new bash exited


Fix:
two workarounds:
1. add a space before the \ 
looks like this:

PS1='$(date) \
'

2. add a space after the \
looks like this:

PS1='$(date)\ 
'

either of the two variants work.


Thanks!




reply via email to

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