Urda Urda - 4 months ago 14
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

For bash and other Bourne-like shells:

java com.myserver.Program "$@"
Comments