惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
S
Schneier on Security
N
News and Events Feed by Topic
N
News | PayPal Newsroom
H
Help Net Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
The Exploit Database - CXSecurity.com
Attack and Defense Labs
Attack and Defense Labs
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
A
About on SuperTechFans
AWS News Blog
AWS News Blog
S
Secure Thoughts
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
C
Cybersecurity and Infrastructure Security Agency CISA
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
MyScale Blog
MyScale Blog
Martin Fowler
Martin Fowler
Help Net Security
Help Net Security
人人都是产品经理
人人都是产品经理
Latest news
Latest news
C
Cyber Attacks, Cyber Crime and Cyber Security
大猫的无限游戏
大猫的无限游戏
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
月光博客
月光博客
H
Hacker News: Front Page
P
Proofpoint News Feed
N
News and Events Feed by Topic
H
Heimdal Security Blog
L
Lohrmann on Cybersecurity
有赞技术团队
有赞技术团队
L
LangChain Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - tooli

没有技术要求,只需5步就能完成数据分析和图表制作,DuckDB可将数据分析门槛铲平。 在超大数据集下 DuckDB 与 MySQL 查询速度对比 ChatGPT有多强?真的能替代程序员?一起来看看! PHP + Redis 实现定时任务触发 测试PHP几种方法写入文件的效率与安全性 简析小黑是如何盗取cookie登录用户账号 一个'&'引起md5签名不一致问题 linux学习:curl与netcat用法整理 swoole+websocket+redis实现一对一聊天 使用COOKIE实现登录 VS 使用SESSION实现登录 巧用PHP中__get()魔术方法 用户表分表原理 linux学习:用户管理 linux学习:网络(防火墙)及系统安全相关命令学习 MySQL语句技巧 实习那些事儿 shell 环境下MySQL的基本操作指令总结 linux学习:归档,备份及进程相关命令用法整理 Docker简介以及使用docker搭建lnmp的过程(多PHP版本)
在windwos创建的脚本文件在linux环境中无法执行的问题
tooli · 2021-07-28 · via 博客园 - tooli

原因:在windows下创建的文件采用的文件模式是dos,由于不同系统对有些字符的定义不同,比如对于回车符的定义:
Windows:0D0A
Unix/Linux: 0A
MAC: 0D

所以在windows下创建的sh文件在linux环境无法直接执行。

解决方式1:

在windows的编辑器中转换,以notepad++为例子:

打开文件 -> 编辑 -> 文档格式转换 -> 转为 Unix(LF)

解决方式2:

在linux的编辑器中转换,以vim为例子:

打开文件:vim test.sh

在底线命令模式下输入

:set ff

回车

显示fileformat=dos

重新设置:

在底线命令模式下输入:

:set ff=unix

回车,然后再底线命令模式下输入:wq 保存退出。

再次执行就可以了。当然没有语法错误的话。