当前位置:网站首页>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.
边栏推荐
- shell-第八章练习
- [flask advanced] deeply understand the application context and request context of flask from the source code
- Redis之压缩列表ziplist
- JS convert pseudo array to array
- Reinforcement Learning 强化学习(三)
- Openstack Skyline 组件安装
- TPS calculation in performance test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- feign客户端请求之LoadBalancerLifecycle生命周期
- 我,AI博士生,在线众筹研究主题
- Some usages of beautifulsoup
猜你喜欢

HCIP(13)

Code representation learning: introduction to codebert and other related models

BGP federal experiment

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

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

Reinforcement learning (III)

Flame framework - Flame WTF form: file upload, verification code

从宏观到微观 零基础 详解bert

ESP8266 使用 DRV8833驱动板驱动N20电机

哥廷根大学提出CLIPSeg:一个使用文本和图像prompt能同时作三个分割任务的模型
随机推荐
MySQL master-slave replication and read-write separation
Esp32c3 based on the example tutorial of esp32 Rainmaker development under Arduino framework
用Unity不会几个插件怎么能行?Unity各类插件及教程推荐
HCIP(12)
Learn NLP with Transformer (Chapter 6)
API supplement of JDBC
信息熵的定义
Mlx90640 infrared thermal imager temperature measurement module development notes (V)
【Servlet】请求的解析
SQL语言(五)
[servlet] request parsing
让运动自然发生,FITURE打造全新生活方式
BeautifulSoup的一些用法
Guys, flick CDC table API, Mysql to MySQL, an application that can
shell- 第七章练习
Flask framework - Message flash
NowCoderTOP1-6——持续更新ing
Reinforcement Learning 强化学习(四)
Esp8266 uses drv8833 drive board to drive N20 motor
二合一的集度,任重道远