This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: profile_d
On 2016-12-06, Ken Brown wrote:
> On 12/6/2016 9:49 AM, Charlie Perkins wrote:
> >Hello anyone,
> >
> >Could someone tell me what profile_d does?
> >
> >There doesn't seem to be a man page, info, or any way I can find out!
>
> It's defined in /etc/profile, shortly before the call to 'profile_d
> sh'. The latter runs all the *.sh scripts in /etc/profile.d, with
> some fiddling to get locales right.
>
> >I'm getting the following errors from profile_d when /etc/profile
> >invokes 'profile_d sh':
> >
> >>-bash: [: too many arguments
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: too many arguments
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
> >>-bash: [: =: unary operator expected
>
> I'm guessing that these errors are generated by the line
>
> if [ "${_LC_SAVE_}" = "null" ]; then
>
> in the definition of profile_d. Is LC_ALL defined in your
> environment? Does it have spaces in it?
I've seen that error from my own bash scripts when I neglect to
enclose a variable in double-quotes before testing it, as
if [ $THIS = "That" ]; then
and when in some situation that variable is not set. I would not
expect to see that error from the line
if [ "${_LC_SAVE_}" = "null" ]; then
because ${_LC_SAVE_} _is_ surrounded by double-quotes and so the
binary operator = will have operands on both sides.
However, profile_d is sourcing every .sh file in /etc/profile.d and
one or more of those files may not be enclosing some variable(s) in
double-quotes. All of the .sh files in my /etc/profile.d handle
their variables correctly, so the error is probably in the
/etc/profile.d/<package>.sh file of some package that I don't have
installed.
Regards,
Gary
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple