bash argval not read

时间:2015-06-30 13:25:21

标签: bash shell scripting

Here is the content of my bash script:

 #!/bin/bash

 set INPFILE=$argv[1]

 echo "Your input file is "
 echo $INPFILE

and I execute it as:

 $ ./script.sh inputfile.in

For some reason, bash doesn't accept the argval[1]. I do not receive an error either.

BTW, the output is:

 Your input file is

1 个答案:

答案 0 :(得分:2)

Change set INPFILE=$argv[1] to:

INPFILE="$1"

$1, $2, $3 .... etc are the positional parameters passed to the script/function.

See the manual for more info.