> -----Original Message----- > From: Leonardo Sandoval > [mailto:[email protected]] > Sent: den 3 april 2017 17:45 > To: Peter Kjellerstedt <[email protected]> > Cc: [email protected] > Subject: Re: [OE-core] [PATCH 3/3] base-files: profile: Simplify > setting variables conditionally > > On Mon, 2017-04-03 at 14:48 +0200, Peter Kjellerstedt wrote: > > It is preferred to use `[ "$FOO" ] || ...` instead of > > `[ -z "$FOO" ] && ...` as the latter leaves $? set to 1. > > > > Signed-off-by: Peter Kjellerstedt <[email protected]> > > --- > > meta/recipes-core/base-files/base-files/profile | 14 ++++++-------- > > 1 file changed, 6 insertions(+), 8 deletions(-) > > > > diff --git a/meta/recipes-core/base-files/base-files/profile > > b/meta/recipes-core/base-files/base-files/profile > > index ceaf15f799..a062028226 100644 > > --- a/meta/recipes-core/base-files/base-files/profile > > +++ b/meta/recipes-core/base-files/base-files/profile > > @@ -3,15 +3,13 @@ > > > > PATH="/usr/local/bin:/usr/bin:/bin" > > EDITOR="vi" # needed for packages like cron, > > git-commit > > -test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc. > > +[ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. > > > > -if [ "$HOME" = "ROOTHOME" ]; then > > - PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin > > -fi > > -if [ "$PS1" ]; then > > - # works for bash and ash (no other shells known to be in use here) > > - PS1='\u@\h:\w\$ ' > > -fi > > +# Add /sbin & co to $PATH for the root user > > +[ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin > > + > > +# Set the prompt for bash and ash (no other shells known to be in use here) > > +[ -z "$PS1" ] || PS1='\u@\h:\w\$ ' > > Here you are using [ -z ] instead of [ ], is this intended? I do not > think so based on your commit message.
Yes, it is intentional to maintain the original functionality. However, I may have to update the commit message a bit. It was written when I had only done the change for the $TERM variable. > > > > if [ -d /etc/profile.d ]; then > > for i in /etc/profile.d/*.sh; do > > -- > > 2.12.0 //Peter -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
