简体   繁体   中英

Apply Linux command recursively to all files in directory of single (.sh) type

I am trying to apply this command sed -i -e 's/\\r$//' to all Shell ( .sh ) files in my directory I have tried:

sed -i -e -R 's/\r$//' *.sh

But this throws an unknown character error.

Any help would be great cheers!

This is an argument order issue. -e expects the expression/script as the next argument and you are giving it -R .

Swap those two arguments sed -i -e '....' .

That being said the dos2unix program exists for this purpose as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM