当前位置:网站首页>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.
边栏推荐
- Learn NLP with Transformer (Chapter 5)
- Nb-iot control LCD (date setting and reading)
- AI system frontier dynamics issue 43: ONEFLOW V0.8.0 officially released; GPU finds human brain connections; AI doctoral online crowdfunding research topic
- Google Earth engine -- Statistics on the frequency of land classification year by year
- 机智云物联网平台 STM32 ESP8266-01S 简单无线控灯
- 数字孪生万物可视 | 联接现实世界与数字空间
- Learning Weekly - total issue 63 - an open source local code snippet management tool
- 100W!
- NowCoderTOP1-6——持续更新ing
- 【flask高级】结合源码详解flask的运行机制(出入栈)
猜你喜欢

Learn NLP with Transformer (Chapter 5)

学习路之PHP--TP5.0使用中文当别名,报“不支持的数据表达式”

推荐系统-协同过滤在Spark中的实现

Redis sentry, high availability executor

SQL语言(四)

Hcip experiment (03)
![[flask advanced] combined with the source code, explain the operation mechanism of flask (in and out of the stack)](/img/a0/9110b83ff5c7965809bbc9f3948956.jpg)
[flask advanced] combined with the source code, explain the operation mechanism of flask (in and out of the stack)

Mlx90640 infrared thermal imager temperature measurement module development notes (V)

Nowcodertop7-11 - continuous updating

Flask framework -- flask caching
随机推荐
Flask framework - session and cookies
Implementation of recommendation system collaborative filtering in spark
HDD杭州站全程体验有感
[flask advanced] combined with the source code, explain the operation mechanism of flask (in and out of the stack)
The most detailed MySQL index analysis (mind map is attached at the end of the article)
The integration of two in one has a long way to go
MLX90640 红外热成像仪测温模块开发笔记(五)
Esp8266 uses drv8833 drive board to drive N20 motor
Google Earth engine -- Statistics on the frequency of land classification year by year
Digital twin everything can be seen | connecting the real world and digital space
数字孪生万物可视 | 联接现实世界与数字空间
HCIA experiment (09)
Signal integrity (SI) power integrity (PI) learning notes (XXXIII) 102 general design rules to minimize signal integrity problems
[flask advanced] deeply understand the application context and request context of flask from the source code
机智云物联网平台 STM32 ESP8266-01S 简单无线控灯
100W!
[high concurrency] how to realize distributed flow restriction under 100 million level traffic? You must master these theories!!
C# Newtonsoft. Jason advanced usage
MySQL master-slave replication and read-write separation
Hcip experiment (03)