为所有指定文件加Header header='/*\n * Copyright (c) 2015 by MyCompany, Inc.\n * All rights reserved.\n */\n' find ~/my-proj/*.sh -exec sed -i "1s|^|$header|" {} \; linux运行windows的bash文件'\r'问题 sed -i 's/\r$//' filename