diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2017-04-03 14:48:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-16 14:08:28 +0100 |
commit | 8033fd4ad15e9c7406f0a477484af98270653ca6 (patch) | |
tree | 90baa4e453c9485ce9aa6acf3e5cbea95857f235 | |
parent | ad2778693eaa19f591dca5795ed77f3f878546de (diff) | |
download | poky-8033fd4ad15e9c7406f0a477484af98270653ca6.tar.gz |
base-files: profile: Simplify setting variables conditionally
It is preferred to use `[ "$FOO" ] || ...` instead of
`[ -z "$FOO" ] && ...` as the latter leaves $? set to 1.
(From OE-Core rev: d76c68505c36dbf383a989f3c2458abc765e2c19)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/base-files/base-files/profile | 14 |
1 files 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 @@ | |||
3 | 3 | ||
4 | PATH="/usr/local/bin:/usr/bin:/bin" | 4 | PATH="/usr/local/bin:/usr/bin:/bin" |
5 | EDITOR="vi" # needed for packages like cron, git-commit | 5 | EDITOR="vi" # needed for packages like cron, git-commit |
6 | test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc. | 6 | [ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc. |
7 | 7 | ||
8 | if [ "$HOME" = "ROOTHOME" ]; then | 8 | # Add /sbin & co to $PATH for the root user |
9 | PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin | 9 | [ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin |
10 | fi | 10 | |
11 | if [ "$PS1" ]; then | 11 | # Set the prompt for bash and ash (no other shells known to be in use here) |
12 | # works for bash and ash (no other shells known to be in use here) | 12 | [ -z "$PS1" ] || PS1='\u@\h:\w\$ ' |
13 | PS1='\u@\h:\w\$ ' | ||
14 | fi | ||
15 | 13 | ||
16 | if [ -d /etc/profile.d ]; then | 14 | if [ -d /etc/profile.d ]; then |
17 | for i in /etc/profile.d/*.sh; do | 15 | for i in /etc/profile.d/*.sh; do |