Shell编程问题汇总

1、执行shell脚本时报错let: not found的几种解决方法

2、linux shell中 出现select not found问题

3、ubuntu下rename



执行shell脚本时报错let: not found的几种解决方法


脚本报错原因:

Ubuntu默认使用的shell解析是dash,dash只有bash一部分的功能

首先我的系统执行

$  echo $0

-bash

$   sudo dpkg-reconfigure dash

Shell编程问题汇总_第1张图片

选择 No,使用bash作为默认shell



linux shell中 出现select not found问题


#!/bin/sh  

echo "You choice?"  

select var in "a" "b" "c";do  

break;  

done  

echo $var  

运行时出现:

select.sh: 3: select: not found

select.sh: 5: Syntax error: "done" unexpected

把#!/bin/sh改为#!/bin/bash

执行脚本时将sh select.sh改为 bash select.sh


ubuntu之rename


http://www.linuxidc.com/Linux/2016-11/137041.htm

你可能感兴趣的:(Shell编程问题汇总)