从传递bash脚本ALL另一个命令的参数 [英] Pass ALL Arguments from Bash Script to Another Command
本文介绍了从传递bash脚本ALL另一个命令的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是抓住所有的bash脚本给定的参数,并将其全部传递到脚本中的另一个命令最简单的方法?例如:
命令行:
./ runProgram.sh [参数HERE]
脚本:
#! /斌/庆典
CD斌/
Java的com.myserver.Program [参数HERE]
解决方案
有关的庆典的和其他类似Bourne外壳:
的Java com.myserver.Program$ @
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]
解决方案
For bash and other Bourne-like shells:
java com.myserver.Program "$@"
这篇关于从传递bash脚本ALL另一个命令的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文