Why do you want to set things conditionally like that?
This feels like it's a very incorrect solution to a problem that you're making far more complicated than it needs to be.
This feels like it's a very incorrect solution to a problem that you're making far more complicated than it needs to be.
The following is just a contrived example. Why would I do that? Because I can
# Bring up services without a command
#
# usage:
# nocmd.sh up -d service_name
function _compose {
docker-compose -f docker-compose.yml $@
}
function nocmd {
cat << EOF
services:
$1:
command: tail -f /dev/null
EOF
}
function nocmd_compose {
local service=${@: -1}
_compose -f <(nocmd "$service") $@
}
nocmd_compose $@