Urda Urda - 1 year ago 151
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]


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

Answer Source

For bash and other Bourne-like shells:

java com.myserver.Program "$@"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download