我正在从.txt文件中提取行:Say Input.txt
a
*
b
然后我用阅读
#!/bin/bash
file=$1
ans=0
while read -r line || [[ -n "$line" ]]
do
echo $line
done < $file # passing the file
我得到以下输出
a
test main.py sic.sh
b
显示我目录中的文件而不是*的位置
我想在需要检测/读取的*字符的基础上做出一些决定*?
始终引用变量:
#!/bin/bash
file="$1"
ans=0
while read -r line || [[ -n "$line" ]]
do
echo "$line"
done < "$file" # passing the file