I've got a case:
case $1 in
"start") exec docker-compose up ;;
"check-types") docker-compose run --rm myapp mypy --config-file=mypy.ini $2;;
"help" | *) print-help ;;
esac
I would like to replace $2 written in "check-types" with an if statment which would state something similar to:
if [[ $2 ]]; then
$2
else
.
fi
Is that possible in one line of bash?
Example of the desired behavior:
- writing
./cli check-typesexecutesdocker-compose run --rm myapp mypy --config-file=mypy.ini . - writing
./cli check-types app/testexecutesdocker-compose run --rm myapp mypy --config-file=mypy.ini app/test