二丫讲梵 二丫讲梵
首页
  • 最佳实践
  • 迎刃而解
  • Nginx
  • Php
  • Zabbix
  • AWS
  • Prometheus
  • Grafana
  • CentOS
  • Systemd
  • Docker
  • Rancher
  • Ansible
  • Ldap
  • Gitlab
  • GitHub
  • Etcd
  • Consul
  • RabbitMQ
  • Kafka
  • MySql
  • MongoDB
  • OpenVPN
  • KVM
  • VMware
  • Other
  • ELK
  • K8S
  • LLM
  • Nexus
  • Jenkins
  • 随写编年
  • 家人物语
  • 追忆青春
  • 父亲的朋友圈
  • 电影音乐
  • 效率工具
  • 博客相关
  • Shell
  • 前端实践
  • Vue学习笔记
  • Golang学习笔记
  • Golang编程技巧
  • 学习周刊
  • Obsidian插件周刊
关于
友链
  • 本站索引

    • 分类
    • 标签
    • 归档
  • 本站页面

    • 导航
    • 打赏
  • 我的工具

    • 备忘录清单 (opens new window)
    • json2go (opens new window)
    • gopher (opens new window)
    • 微信MD编辑 (opens new window)
    • 国内镜像 (opens new window)
    • 出口IP查询 (opens new window)
    • 代码高亮工具 (opens new window)
  • 外站页面

    • 开往 (opens new window)
    • ldapdoc (opens new window)
    • HowToStartOpenSource (opens new window)
    • vdoing-template (opens new window)
GitHub (opens new window)

二丫讲梵

行者常至,为者常成
首页
  • 最佳实践
  • 迎刃而解
  • Nginx
  • Php
  • Zabbix
  • AWS
  • Prometheus
  • Grafana
  • CentOS
  • Systemd
  • Docker
  • Rancher
  • Ansible
  • Ldap
  • Gitlab
  • GitHub
  • Etcd
  • Consul
  • RabbitMQ
  • Kafka
  • MySql
  • MongoDB
  • OpenVPN
  • KVM
  • VMware
  • Other
  • ELK
  • K8S
  • LLM
  • Nexus
  • Jenkins
  • 随写编年
  • 家人物语
  • 追忆青春
  • 父亲的朋友圈
  • 电影音乐
  • 效率工具
  • 博客相关
  • Shell
  • 前端实践
  • Vue学习笔记
  • Golang学习笔记
  • Golang编程技巧
  • 学习周刊
  • Obsidian插件周刊
关于
友链
  • 本站索引

    • 分类
    • 标签
    • 归档
  • 本站页面

    • 导航
    • 打赏
  • 我的工具

    • 备忘录清单 (opens new window)
    • json2go (opens new window)
    • gopher (opens new window)
    • 微信MD编辑 (opens new window)
    • 国内镜像 (opens new window)
    • 出口IP查询 (opens new window)
    • 代码高亮工具 (opens new window)
  • 外站页面

    • 开往 (opens new window)
    • ldapdoc (opens new window)
    • HowToStartOpenSource (opens new window)
    • vdoing-template (opens new window)
GitHub (opens new window)
  • 最佳实践

  • 迎刃而解

    • 记一次关于tomcat的踩坑的经历
    • 解决VNC连接闪退的问题
    • 一次升级线上服务器内核的经历
    • 记一次给笔记安装Windows系统遇到的一些坑
    • 解决一个新安装系统使用yum时报错的问题
    • 服务器存储不够了之直接挂载一块儿新磁盘的操作
    • 服务器存储不够了之在原逻辑卷上扩容的操作
    • 解决php-fpm启动之后没有9000端口的问题
    • 解决MySQL问题:Got error 28 from storage engine
    • 解决git clone报错Peer’s Certificate has expired的问题
    • Linux的普通用户bash突然报错bash fork retry No child processes的解决办法
    • 分析解决脚本执行时总是报出command not found
    • confluence数据目录满了
    • 利用prlimit动态修改应用进程的最大文件打开数
    • vim复制代码包含注释时格式会乱掉解决办法
    • python如何快速迁移依赖库
    • YUM安装提示--skip-broken-to-work-around-the-problem
    • 请求nginx返回413的错误
    • Linux系统环境变量被覆盖所有命令找不到怎么办
    • Centos7更改yum源为阿里云
    • node编译报错
    • git-commit错了如何更改
    • 关于执行journalctl时的一个报错
    • yum安装epel之后报错
    • umount卸载磁盘的时候提示busy
    • pip安装依赖时报ssl的问题
    • lavel框架缓存目录的问题
    • Debian系统中执行shell报错unexpected operator
    • Vuepress项目编译时报routines的错误
    • 一次因为Mac系统升级引发的ssh无法免密登陆的问题
  • Nginx

  • Php

  • Zabbix

  • AWS

  • Prometheus

  • Grafana

  • Loki

  • CentOS

  • Supervisord

  • Systemd

  • Docker

  • Docker-Compose

  • Rancher

  • Ansible

  • OpenLdap

  • GitLab

  • GitHub

  • Etcd

  • Consul

  • RabbitMQ

  • Kafka

  • Mysql

  • MongoDB

  • OpenVPN

  • Kvm

  • VMware

  • 配置文件详解

  • Other

  • 运维观止
  • 迎刃而解
二丫讲梵
2022-05-21

Debian系统中执行shell报错unexpected operator

文章发布较早,内容可能过时,阅读注意甄别。

新的 Jenkins 测试环境通过 docker 搭建,官方镜像的基础镜像使用的是 Debian 系统,在执行到一些 shell 步骤的时候,总是会报如下错误:

/var/jenkins_home/workspace/ops/test-eryajf-blog@tmp/durable-8207aae1/script.sh: 5: [: ALL: unexpected operator
1

这是由于 Debian 系统以及 Ubuntu 系统在最近新系统中,默认的 sh 软链到的是 dash,而非 bash。

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar 28 08:00 /bin/sh -> dash
1
2

通过执行如下命令,可以将 sh 软链到 bash 上。

$ dpkg-reconfigure dash
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Configuring dash
----------------

The system shell is the default command interpreter for shell scripts.

Using dash as the system shell will improve the system's overall performance. It does not alter the shell presented to interactive users.

Use dash as the default system shell (/bin/sh)? [yes/no] no  需在此处输入no

Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

更改成功之后,再看一下当前 sh 的软链:

ls -l /bin/sh
lrwxrwxrwx 1 root root 4 May 21 22:35 /bin/sh -> bash
1
2

然后再运行脚本就不会报刚刚那个错了。

微信 支付宝
上次更新: 2024/09/26, 21:41:44
lavel框架缓存目录的问题
Vuepress项目编译时报routines的错误

← lavel框架缓存目录的问题 Vuepress项目编译时报routines的错误→

最近更新
01
记录二五年五一之短暂回归家庭
05-09
02
学习周刊-总第210期-2025年第19周
05-09
03
学习周刊-总第209期-2025年第18周
05-03
更多文章>
Theme by Vdoing | Copyright © 2017-2025 | 点击查看十年之约 | 浙ICP备18057030号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式