c - c 中的 shell 程序运行但给出“lsh:没有这样的文件或目录。”
问题描述
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define read_buffsize 1024
#define split_buffsize 64
#define delimiters "\t\r\n\a"
int main();
void loop(void);
char *readLine(void);
char **splitLine(char *command);
int start(char** args);
int execute(char **args);
我正在尝试用c制作一个shell程序。程序运行,但是当我输入命令并执行时,它显示“lsh:没有这样的文件或目录”。我把我的函数声明放在他的问题中只是因为我的代码大约有 150 行代码。示例输出如下所示:
> ls -l
lsh: No such file or directory
> pwd
lsh: No such file or directory
>
解决方案
也许您没有安装该程序lsh
。但是lsh
是SSH协议的一种实现。这是维基百科的说明。我认为这lsh
甚至不能替代bash
or sh
。它仅用于登录远程计算机。因此lsh
不知道如何执行它(如果你安装了它)。尝试使可执行字符串(或#define
)bash
不是lsh
。
推荐阅读
- excel - 有谁知道如何执行水平 xlookup
- android - 有什么方法可以写入我位于资产文件夹中的数据库吗?或任何其他替代方法来处理这种情况?
- javascript - 如何在特定时区转换日期
- node.js - 带有文件上传的 AWS Lambda FormData 正文
- python - 用值格式化多维数组
- node.js - nodejs swagger-参数设置问题
- go - Go dlv:无法启动 go 版本对于这个版本的 delve 来说太旧了
- richtextbox - 在 Visual Studio 中,当我将韩文文本添加到 RichTextBox 和 TextBox 时,RichTextBox 中的字符有多余的空间
- python - Selenium 为不同的选项卡下载相同的文件
- python - 调用 asyncio.sleep() 似乎修改了我的对象