Thursday, August 27, 2009

How to stop unix read command escape backslashes

If you want to pipe any output that has backslashes in it (or make 'read' take a string with backslashes) to the read command then you will need to stop the read command treating backslash as escape character by using read -r
e.g.
cleartool ls | while read -r file
do
# do something to file
done

No comments: