1 Overview
- When reading the contents of the file for loop, the output is broken shivers
2. Scene
- demand
- Read the file
- Progressive
Source File
Continuous Delivery with Docker and Jenkins Jenkins 2 Up and Running Jenkins 2.x Continuous Integration Cookbook(3rd) Jenkins Fundamentals
script
#!/bin/bash for line in `cat ${1}` do echo ${line} done
- problem
The result output, this is
Continuous Delivery with Docker and Jenkins Jenkins 2 Up and Running Jenkins 2.x Continuous Integration Cookbook(3rd) Jenkins Fundamentals
3. Solution
- the reason
- Before output, the need to develop ifs
- ifs
- linux environment variables
- slightly
The final script
`` `
#! / Bin / bashOLD_IFS=${IFS}
IFS=""for line in
cat ${1}
do
echo ${line}
doneIFS=${OLD_IFS}
```
4. Other
- ref
- SHELL read each line of the content and output files
- While output by, looks like you do not have this problem ...
- Shell usage in IFS
- SHELL read each line of the content and output files
- doubt
- IFS What the hell is this thing in the end
- $ {1} is a bash script parameter, if that script with awk command, need to refer to $ 1, which prevail in the end it?