mirror of
git://code.qt.io/qt/qt5.git
synced 2026-01-07 23:46:51 +08:00
Fix shell function is_script_executed
It used to return error when tested inside a login shell, because $0 is "-bash" and `basename` was trying to interpret -b as an option. Change-Id: I5faa2dc01e50c7d5bcfc0ab1fcfd910b2538afc2 Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
This commit is contained in:
@@ -65,8 +65,10 @@ fatal () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Takes one argument which should be the filename of this script. Returns true
|
||||
# if the script is being sourced, false if the script is being executed.
|
||||
is_script_executed () {
|
||||
[ x"$(basename "$0")" = x"$1" ]
|
||||
[ x"$(basename $(echo "$0" | sed s/^-//))" = x"$1" ]
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user