Urda Urda - 1 year ago 83
Bash Question

Pass ALL Arguments from Bash Script to Another Command

What is the simplest way to grab all the given arguments for a bash script and pass them all into another command within the script? For example:

Command Line:

./runProgram.sh [ARGS HERE]


Script:

#! /bin/bash
cd bin/
java com.myserver.Program [ARGS HERE]

Answer Source

For bash and other Bourne-like shells:

java com.myserver.Program "$@"