PDA

View Full Version : [SOLVED] bash if condition in /etc/init.d/rc



lavinog
October 13th, 2008, 03:59 PM
I was curious what the "." does in this if statement:

if [ "." = "$sh" ]

line 60 of /etc/init.d/rc

mssever
October 13th, 2008, 04:16 PM
I was curious what the "." does in this if statement:

if [ "." = "$sh" ]line 60 of /etc/init.d/rc
It's checking whether the value of $sh is a single dot. Nothing magic there. In bash tests, = means the same as == in many other languages.

lavinog
October 13th, 2008, 05:54 PM
I see now. I overlooked the sh=. because it was commented out with the debian policy comment

All I was seeing was

sh=sh
if [ "." = "$sh" ] ; then

Which didn't make sense.
Thank you for the response.