The following arguments are valid for docker
command:
docker ps -f"status=exited" --format 'table {{.Names}}'
#output:
# jovial_hellman
# modest_blackwell
So I have created this script
docker-ps-exited
#!/bin/bash
# show exited docker processes
docker ps -f"status=exited" $@
But when I try to add the rest of the arguments in the console it fails:
docker-ps-exited --format 'table {{.Names}}'
# ERROR OUTPUT:
# "docker ps" accepts no arguments.
# See 'docker ps --help'.
#
# Usage: docker ps [OPTIONS]
Why the script fails passing the arguments correctly?
How should I write it in order to be able to accept any arguments I pass at the end?
$@
? Quoting it would mean creating a list of individually quoted elements. Not quoting it would create a list of words that has been split on whitespaces and had filename globbing applied to them to possibly generate more words. See both Why does my shell script choke on whitespace or other special characters? and When is double-quoting necessary? – Kusalananda Dec 19 '19 at 13:02$@
. Thanx! – Marinos An Dec 19 '19 at 13:05