Terminal - command not found

泄露秘密 提交于 2019-12-17 21:23:14

问题


I'm trying to learn to write shell scripts and use the Terminal.

In Users/user/Development/linux I've got a script called sysinfo_page.

So I'm in the linux folder in the terminal and I can see the sysinfo_page when I type the ls command.

However, when I enter the following command:

sysinfo_page > sysinfo_page.html

I receive the following message:

-bash: sysinfo_page: command not found

How do I resolve this?


回答1:


If you want to run a script file form the current directory, you have to write ./ before your script name:

./script.sh



回答2:


Your command may not be an executable file. Try this:

chmod +x sysinfo_page
./sysinfo_page > sysinfo_page.html

The first line will set the eXecutable flag on the file, the second will run it from the current dir. Note that if you want to run a file in the current directory and that dir is not included in your PATH, you need to prepend ./ or else the shell won't find it.



来源:https://stackoverflow.com/questions/19497862/terminal-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!