Some dumb questions born of frustration

Janina Sajka janina at rednote.net
Fri Oct 28 13:30:28 UTC 2016


Thanks, Tim. This bit of code in my profile is something I conjured up
years and years ago. But, even after all these years of using first Unix
and then Linux, I've not clarified in my own mind the precise difference
between single and double quoting. There's one more delimiter, of
course, and I suppose there must be a good presentation on these out
there somewhere.

Thanks for this response.

Janina

Tim Chase writes:
> On October 27, 2016, Janina Sajka wrote:
> > Try the following:
> > 
> > PS1="\\\$"
> > 
> > I'm sorry, I don't recall the logic of the triple backslash.
> 
> Because you're using double-quotes, the stuff inside them is still
> interpreted.  So the first backslash escapes the second backslash and
> the third backslash escapes the "$" so that the assigned value is a
> literal backslash followed by a literal "$".  In this particular
> case, because nothing follows the "$" that could be interpreted as a
> variable expansion, it would be safe to use
> 
>   PS1="\\$"
> 
> but I'd just recommend using single quotes instead of double-quotes
> which prevents the escaping altogether:
> 
>   PS1='\$'
> 
> -tim
> 
> 
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://www.redhat.com/mailman/listinfo/blinux-list

-- 

Janina Sajka,	Phone:	+1.443.300.2200
			sip:janina at asterisk.rednote.net
		Email:	janina at rednote.net

Linux Foundation Fellow
Executive Chair, Accessibility Workgroup:	http://a11y.org

The World Wide Web Consortium (W3C), Web Accessibility Initiative (WAI)
Chair, Accessible Platform Architectures	http://www.w3.org/wai/apa




More information about the Blinux-list mailing list