当前位置:网站首页>There is a newline problem when passing shell script parameters \r
There is a newline problem when passing shell script parameters \r
2022-07-25 11:18:00 【Panic L】
Recently, with Nodepad++ Write Shell When the script passes parameters dynamically , It is found that sometimes parameters carry \r A newline , The editor is also Shell Script language . At first glance, I knew it was the problem of line breaks , But some scripts don't bring \r Symbol , Some with , Really !

Question why :
- Unix In the system , Each line ends with "< Line break >”, namely "
\n"; - Windows In the system , Each line ends with "< Line break >< return vehicle >”, namely "
\n\r”.
So when you go from Windows Put the script into Linux After the , Will be able to "\n\r” Bring together
resolvent :
allSyncTask.sh: Script name , Customize
1. Use command :
dos2unix allSyncTask.sh
Can't find dos2unix On command , install dos2unix:
yum install dos2unix
yum install unix2dos
2. Get rid of "\r" command :( Remember not to use two ", Otherwise, all belts r The letters will be replaced )
sed -i "s/\r//" allSyncTask.sh
Related articles
- DataX | stay Liunx Install and use .
- DataX | MySQL Multi table full synchronization and multi table timed incremental synchronization .
- DataX Step on the pit 1 | Failed to connect to database . Please check your account number 、 password 、 Database name 、IP、Port.
- DataX Step on the pit 2 | Timing task crontab Do not execute or report an error :/bin/sh: java: command not found.
边栏推荐
- 用Unity不会几个插件怎么能行?Unity各类插件及教程推荐
- mysql主从复制与读写分离
- JS convert pseudo array to array
- shell-第五章作业
- Openstack Skyline 组件安装
- MLX90640 红外热成像仪测温模块开发笔记(五)
- From the perspective of open source, analyze the architecture design of SAP classic ERP that will not change in 30 years
- Esp32c3 based on the example tutorial of esp32 Rainmaker development under Arduino framework
- HCIA experiment (07) comprehensive experiment
- 让运动自然发生,FITURE打造全新生活方式
猜你喜欢

只知道预制体是用来生成物体的?看我如何使用Unity生成UI预制体

SQL语言(一)

Ue4.26 source code version black screen problem of client operation when learning Wan independent server

HCIA experiment (10) nat

STM32CubeMX学习记录--安装配置与使用

Shell 脚本参数传递时有 \r 换行符问题

Flask framework - session and cookies

Flask framework -- flask caching

同事看了我的代码惊呼:居然是这么在Unity中用单例的

redis 哨兵,高可用的执行者
随机推荐
学习路之PHP--TP5.0使用中文当别名,报“不支持的数据表达式”
Esp8266 uses drv8833 drive board to drive N20 motor
SQL语言(一)
Hcip experiment (01)
Learn NLP with Transformer (Chapter 4)
100W!
Guys, flick CDC table API, Mysql to MySQL, an application that can
shell-第四天作业
HDD Hangzhou station full experience
HCIA experiment (10) nat
HCIA experiment (07) comprehensive experiment
Understand the life cycle and route jump of small programs
HCIP(11)
A troubleshooting record of DirectShow playback problems
史上最全的立创元器件封装库导入AD详细教程(一直白嫖一直爽)
shell-第六章练习
[cloud enjoys freshness] community weekly · Vol 72 - the first opening ceremony of the 2022 Huawei developer competition in China was launched; Huawei cloud koomessage is in hot public beta
MySQL master-slave replication and read-write separation
MLX90640 红外热成像仪测温模块开发笔记(五)
性能测试中TPS的计算【杭州多测师】【杭州多测师_王sir】