新建一个test文件,每行一个命令,内容如下:

    1. # cat ./test
    2. echo "1, hello, world"
    3. echo "2, hello, world"
    4. echo "3, hello, world"
    5. echo "4, hello, world"
    6. echo "5, hello, world"

    使用cat 输出文件内容,并一行一行执行

    1. # cat test | sh -x
    2. + echo '1, hello, world'
    3. 1, hello, world
    4. + echo '2, hello, world'
    5. 2, hello, world
    6. + echo '3, hello, world'
    7. 3, hello, world
    8. + echo '4, hello, world'
    9. 4, hello, world
    10. + echo '5, hello, world'
    11. 5, hello, world