Linux:各种错误

ShineLee / 2023-08-14 / 原文

1、sudo: a terminal is required to read the password; either use the -S option to read from standard in or configure an askpass helper

sudo: a terminal is required to read the password; either use..... 问题解决方法

2、xxx not found或未找到命令

cc:yum -y install gcc-c++ 

cd:cd与路径间需要有空格

make:sudo yum install make

rz:yum install lrzsz

vim:yum -y install vim

wget:yum -y install wget

3、由于shell的if语法错误导致的错误:

  • 错误的替换/bad subsitution

  • 未预期的符号 `then' 附近有语法错误

  • 未预期的符号 `fi' 附近有语法错误

正确的if写法:

if [ $`whoami`="miduser" ];then
    exit
    echo "exit"
fi

需要注意的地方:

  • if、中括号、内部表达式之间必须要有有空格
  • then之后必须有执行语句,不能写空if
  • 判断字符串相等时,要用=而非==。

4、auto/options: No such file or directory

 出现于:bash ./configure配置nginx时

解决方案,先cd进入configure所在目录,再用bash ./configure,不然即使是bash 绝对路径/configure也不行。

5、nginx: [emerg] unexpected "}" in /usr/local/nginx/nginx-1.20.2/conf/nginx.conf:45

在写nginx配置文件时,最后的分号忘记写了