Skip to content

Latest commit

 

History

History
71 lines (39 loc) · 1019 Bytes

File metadata and controls

71 lines (39 loc) · 1019 Bytes

linux错误

[TOC]

ubuntu的dash问题

问题

在执行sh文件时报Syntax error: "(" unexpected错误

原因

Ubuntu/Debian为了加快开机速度,用dash代替了传统的bash,是dash在捣鬼,解决方法就是取消dash

解决

sudo dpkg-reconfigure dash
# 选no

wsl环境下git clone报错

问题

在wsl环境下的windows文件夹中执行git clone xx报错:

xx/.git/config.lock failed: Operation not permitted

原因

windows的一些文件系统(如NTFS等)不兼容wsl导致报无权限的问题

解决

echo "[automount]\
enabled = true\
options = \"metadata,umask=22,fmask=11\"\
mountFsTab = false" >> /etc/wsl.conf

shell脚本文件编码格式问题

问题

在linux下执行shell脚本时报错:

Syntax error: "elif" unexpected (expecting "then")

原因

window与linux/unix环境的问价编码格式不一致。

解决

sed -i 's/\r//' xx  # xx shell脚本