我有一段代码,使用while循环逐行读取文件。在while循环内部,我有一些条件。是否有一种方法可以根据条件跳过当前行并读取下一行?让我更加清晰:
while read Line
do
//some sample conditions
a=$Line
if [ "a" == "b" ]
//i want to go to the next line from this point.
done < **inputfile**
非常感谢您的帮助。
我有一段代码,使用while循环逐行读取文件。在while循环内部,我有一些条件。是否有一种方法可以根据条件跳过当前行并读取下一行?让我更加清晰:
while read Line
do
//some sample conditions
a=$Line
if [ "a" == "b" ]
//i want to go to the next line from this point.
done < **inputfile**
非常感谢您的帮助。
使用continue
命令在Bash循环中跳过当前迭代。详情请访问http://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-continue-in-bash-loop/
while read Line
do
# some sample conditions
a=$Line
if [ "$a" == "$b" ] # I assume this is not "a" == "b"
# i want to go to the next line from this point.
read Line
a=$Line
done < **inputfile**