Revision fad4c1e7 tools/ide/QtCreator/QtCreatorSetup.sh
tools/ide/QtCreator/QtCreatorSetup.sh | ||
---|---|---|
263 | 263 |
return 0 |
264 | 264 |
} |
265 | 265 |
|
266 |
### check whether commands are available ####################################### |
|
267 |
# Checks whether the specified commands are available and can be executed. |
|
268 |
# |
|
269 |
# usage: checkCommand [<command> <command> ...] |
|
270 |
# arguments: <command> |
|
271 |
# Name of the command to check. |
|
272 |
# return: 0 |
|
273 |
# All requested commands are available. |
|
274 |
# >0 |
|
275 |
# Number of requested commands that were not found. |
|
276 |
# -1 |
|
277 |
# No argument given. |
|
278 |
# |
|
279 |
function checkCommands { |
|
280 |
local status=0 |
|
281 |
|
|
282 |
# return if no argument was specified |
|
283 |
if [ $# -eq 0 ]; then |
|
284 |
return -1 |
|
285 |
fi |
|
286 |
|
|
287 |
# check all specified commands |
|
288 |
while [ $# -gt 0 ]; do |
|
289 |
command -v $1 &>/dev/null |
|
290 |
if [ $? -ne 0 ]; then |
|
291 |
printWarning "Command '$1' not available.\n" |
|
292 |
status=$((status + 1)) |
|
293 |
fi |
|
294 |
shift 1 |
|
295 |
done |
|
296 |
|
|
297 |
return $status |
|
298 |
} |
|
299 |
|
|
266 | 300 |
################################################################################ |
267 | 301 |
# SPECIFIC FUNCTIONS # |
268 | 302 |
################################################################################ |
Also available in: Unified diff