mkdir命令在bash脚本未找到 [英] mkdir command not found in bash script

查看:2802
本文介绍了mkdir命令在bash脚本未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么我得到错误,同时运行这个简单的脚本:

 #!/斌/庆典阅读-p请输入目录名:DIR
阅读-p请输入路径:PATH
MKDIR -p$ PATH / $ DIR

 第7行上:mkdir:命令未找到


解决方案

不要使用变量 PATH 。这个变量包含要搜索的可执行程序的目录列表。既然你取代它,剧本不能再找到的mkdir 程序。

在一般情况下,避免使用全部大写,这些常常被用来作为外壳或其他程序的参数变量。

I don't know why I get error while running this simple script:

#!/bin/bash

read -p "Please enter directory name: " DIR
read -p "Please enter the path: " PATH
mkdir -p "$PATH/$DIR"

line 7: mkdir: command not found

解决方案

Don't use the variable PATH. This variable contains a list of directories to search for executable programs. Since you're replacing it, the script can no longer find the mkdir program.

In general, avoid using variables that are all uppercase, these are often used as parameters for the shell or other programs.

这篇关于mkdir命令在bash脚本未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆