readLBL.sh我怎样才能保持文件名可变从这个代码
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "Text read from file: $line"
done < "$1"
当我运行在终端这个shell脚本,我不得不为运行插入文件命名为
例子:
./readLBL.sh science.txt
输出:
58050364;汤姆·琼斯
58050365;珍结婚
我怎能“science.txt”到一些变量像a = "science.txt"
你在'$ 1'中有它 – yoones
赋值$ 1给一个变量'a = $ 1' – hassan
@yoones哇谢谢!我明白了,我是shell脚本的初学者。 –