minit/ubuntu/debian 中 /bin/sh--->dash

本文探讨了GNU/Linux系统中使用Dash(Debian Almquist Shell)替代Bash作为默认/bin/sh的效果,包括系统启动速度的提升及脚本兼容性问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

GNU/Linux 操作系统中的 /bin/sh 是 bash(Bourne-Again Shell)的符号链接,但鉴于 bash 过于复杂,有人把 ash 从 NetBSD 移植到 Linux 并更名为 dash(Debian Almquist Shell),并建议将 /bin/sh 指向它,以获得更快的脚本执行速度。Ubuntu 号称自从他们在 6.10 版里这样做了以后,系统启动速度有了明显的提升。Debian 计划在下一个发行版(代号 lenny)中也将 dash 作为默认的 /bin/sh。

  按照惯例(以及很多写脚本的规范),标记为“#!/bin/sh”的脚本不应使用任何 POSIX 没有规定的特性(使用 bash 特性的脚本要使用“#!/bin/bash”),所以在理论上,这样应该没有任何副作用。但是现实中,Linux 下的很多(不规范的)脚本有所谓 bashism,却在文件头标记为“#!/bin/sh”。有人把脚本失败归咎于 Ubuntu 而不是自己的脚本,这是不公平的。

  刚才在 Debian (testing)下尝试用 dash 作为 /bin/sh,并重启了一下系统,好像快了那么一点点(心理作用?)不过我想它节约的那点时间也许比挂载我的两个 reiserfs 分区用的时间还要少……

  遇到的问题:自己的两个脚本挂了,把“#!/bin/sh”改为“#!/bin/bash”;自己的一个带 bashism 的 Makefile 挂了,加上“SHELL=/bin/bash”。

  在 Debian 下,先安装软件包 dash,然后 dpkg-reconfigure dash,回答 Yes 即可。

  在 Ubuntu 下这已经是默认,如果因为某些原因需要改回到 bash,也是用 dpkg-reconfigure dash。

使用<resultMap id="eqMapVo" type="EquipmentVo"> <result property="eqId" column="eq_id"/> <result property="companyId" column="company_id"/> <result property="itemName" column="item_name"/> <result property="eqName" column="eq_name"/> <result property="serialNumber" column="serial_number"/> <collection property="maps" javaType="Map"> <result column="mm" javaType="string" property="mm"/> <result column="yy" javaType="string" property="yy"/> <result column="week" javaType="string" property="week"/> <result column="dd" javaType="string" property="dd"/> <result column="hh" javaType="string" property="hh"/> <result column="minit" javaType="string" property="minit"/> <result column="eqName" javaType="string" property="eqName"/> <result column="itemName" javaType="string" property="itemName"/> <result column="rm" javaType="bigDecimal" property="rm"/> </collection> </resultMap>映射public class EquipmentVo extends RegionalEquipment { private List<EquipmentDataVo> equipmentDataVoList; private List<Map> maps; public List<Map> getMaps() { return maps; } public void setMaps(List<Map> maps) { this.maps = maps; } public List<EquipmentDataVo> getEquipmentDataVoList() { return equipmentDataVoList; } public void setEquipmentDataVoList(List<EquipmentDataVo> equipmentDataVoList) { this.equipmentDataVoList = equipmentDataVoList; } },抛出org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'maps' of 'class com.hapstar.regional.domain.vo.EquipmentVo' with value '{hh=2023-05-05 16, eqName=RM/7199, itemName=测试项目, rm=1.46}' Cause: java.lang.IllegalArgumentException: argument type mismatch异常,如何处理
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值