I have a batch file like this:
java temptable %1 %2
I need the equivalent shell script for the above. I will pass the arguments to the shell script and that should be passed to temptable.
I have a batch file like this:
java temptable %1 %2
I need the equivalent shell script for the above. I will pass the arguments to the shell script and that should be passed to temptable.
For bash (which is one shell, but probably the most common in the Linux world), the equivalent is:
java temptable $1 $2
assuming there's no spaces in the arguments. If there are spaces, you should quote your arguments:
java temptable "$1" "$2"
You can also do:
java temptable $*
or:
java temptable "$@"
if you want all parameters passed through (again, that second one is equivalent to quoting each of the parameters: "$1" "$2" "$3" ...).
Here is an article, How to pass arguments to a shell script. It covers most about command line arguments
# Call this script with at least 3 parameters, for example
echo "first parameter is $1"
echo "Second parameter is $2"
echo "Third parameter is $3"
exit
0Output:[root@localhost ~]# sh parameters.sh 47 9 34f
irst parameter is 47
Second parameter is 9
Third parameter is 34