如何从BASH输入中获取星号值

时间:2016-03-02 10:26:48

标签: linux bash terminal sh

以下是来自命令行的输入:

bash script.sh "input*" ";" "21" "yyyy-MM-dd"

在我当前的目录中我有两个输入文件:

  • input1.txt
  • input2.txt

虽然我想从输入' $ 1' 获得'输入*' ,但我得到& #39; input1.txt input2.txt' 作为输入。

有没有办法从' $ 1' 获得价值'输入*'

1 个答案:

答案 0 :(得分:-1)

you can use "$1" where 1 is the number of first input parameter

#!/bin/bash

echo "$1"

but you have to pass the input*.txt like this input\*.txt

output

[shell] ➤ ./test7.sh input\*.txt
input*.txt

Regards

Claudio