你好;
我寫了一個shell script,要將文字檔每一行抓入重複輸出文另外script文件.
Shell scripts內容如下:
#!/bin/bash
u=(\/32)
#echo "The numbers in the file are:"
while IFS= read -r line
do
echo "config firewall address
edit $line
set type ipmask
set subnet $line$u
next"
done < file.txt >ip.txt
file為每行一個ip位址:如 95.216.145.1
我需要輸出為底下格式:
config firewall address
edit 95.216.145.1
set type ipmask
set subnet 95.216.145.1/32
next
但實際輸出格式為:
config firewall address
edit 95.216.145.1
set type ipmask
/32 subnet 95.216.145.1
next
請問要如何改這shell script