From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 3/3] base-files: profile: Simplify setting variables conditionally
Date: Mon, 03 Apr 2017 10:45:17 -0500 [thread overview]
Message-ID: <1491234317.17259.82.camel@linux.intel.com> (raw)
In-Reply-To: <20170403124827.24735-3-pkj@axis.com>
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 <peter.kjellerstedt@axis.com>
> ---
> 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.
>
> if [ -d /etc/profile.d ]; then
> for i in /etc/profile.d/*.sh; do
> --
> 2.12.0
>
next prev parent reply other threads:[~2017-04-03 15:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 12:48 [PATCH 1/3] base-files: profile: Whitespace clean up Peter Kjellerstedt
2017-04-03 12:48 ` [PATCH 2/3] base-files: profile: Do not assume that the tty command exists Peter Kjellerstedt
2017-04-03 12:48 ` [PATCH 3/3] base-files: profile: Simplify setting variables conditionally Peter Kjellerstedt
2017-04-03 15:45 ` Leonardo Sandoval [this message]
2017-04-04 7:50 ` Peter Kjellerstedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491234317.17259.82.camel@linux.intel.com \
--to=leonardo.sandoval.gonzalez@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=peter.kjellerstedt@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.