符号链接,别名,cls清除 [英] symbolic links, aliases, cls clear

查看:76
本文介绍了符号链接,别名,cls清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个python程序试图调用''cls''但是失败了:


sh:第1行:cls:找不到命令


i尝试从cls创建别名以清除.profile,.cshrc和

/ etc / profile,但这些选项似乎都不起作用。


我的结论是,正在执行的python程序不使用shell(因为它不识别shell别名)。这个

是否正确?


我应该使用符号链接吗?如果是的话,我应该把它放在哪里?


别名和符号链接有什么区别?


如果我执行像''这样的命令清除清除屏幕,

shell在哪里找到命令''clear''?


我用的是os x。


谢谢

mp

i have a python program which attempts to call ''cls'' but fails:

sh: line 1: cls: command not found

i tried creating an alias from cls to clear in .profile, .cshrc, and
/etc/profile, but none of these options seem to work.

my conclusion is that a python program that is executing does not use
the shell (because it does not recognize shell aliases). is this
correct?

should i use a symbolic link? if so, where should i place it?

what is the difference between aliases and symbolic links?

if i execute a command like ''clear'' to clear the screen, where does the
shell look to find the command ''clear''?

i''m using os x.

thanks
mp

推荐答案

" ;熔点" <毫安********* @ email.com>写道:
"mp" <ma*********@email.com> writes:
我有一个python程序试图调用''cls''但失败了:

sh:第1行:cls:命令未找到
<我尝试从cls创建别名以清除.profile,.cshrc和
/ etc / profile,但这些选项似乎都不起作用。

我的结论是正在执行的python程序不使用shell(因为它不识别shell别名)。这是正确的吗?


是的。

我应该使用符号链接吗?如果是的话,我应该把它放在哪里?


你可以,但我不认为这是最好的解决方案。

别名和符号链接有什么区别?


别名仅存在于shell中。符号链接存在于

系统文件中。

如果我执行清除这样的命令来清除屏幕,那么
shell看起来在哪里找到命令''clear''?
i have a python program which attempts to call ''cls'' but fails:

sh: line 1: cls: command not found

i tried creating an alias from cls to clear in .profile, .cshrc, and
/etc/profile, but none of these options seem to work.

my conclusion is that a python program that is executing does not use
the shell (because it does not recognize shell aliases). is this
correct?
Yes.
should i use a symbolic link? if so, where should i place it?
You could, but I don''t think it''s the best solution.
what is the difference between aliases and symbolic links?
Aliases exist only in a shell. Symbolic links exist in the file
system.
if i execute a command like ''clear'' to clear the screen, where does the
shell look to find the command ''clear''?




一般来说,它会搜索



Generally it searches


PATH,找到一个名为clear的可执行文件。


我不太了解Python(请注意交叉帖子),但是如果它

提供了一种方法来检测你的操作系统'继续运行,你

可以执行cls如果你在Windows上,或清除如果你在一个类似Unix的系统上。或者可能有一些带有

清屏功能的Python库。


您确定要清除屏幕吗?如果我运行你的程序并且

它会为我清除我的屏幕,它可能会删除重要的

信息。如果你想完全控制屏幕,你应该使用像curses或ncurses这样的东西(可能有一个Python

接口)。


-

Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。
PATH for an executable file called "clear".

I don''t know Python very well (note the cross-post), but if it
provides a way to detect which operating system you''re running on, you
could execute "cls" if you''re on Windows, or "clear" if you''re on a
Unix-like system. Or there might be some Python library with a
clear-screen function.

Are you sure you want to clear the screen? If I run your program and
it clears my screen for me, it could be erasing significant
information. If you want complete control over the screen, you should
probably use something like curses or ncurses (there may be a Python
interface to it).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


在2006-03-29,mp写道:
On 2006-03-29, mp wrote:
我有一个python程序试图调用' 'cls''但失败了:

sh:第1行:cls:命令未找到

我尝试从cls创建别名以清除.profile,.cshrc和
/ etc / profile,但这些选项似乎都不起作用。


为什么不调用''clear'',因为''cls''不存在?

我的结论是一个正在执行的python程序不使用shell(因为它不识别shell别名)。这是正确的吗?


即使shell脚本通常也不会扩展别名。

我应该使用符号链接吗?若然,我应该把它放在哪里?

别名和符号链接有什么区别?


乌鸦和写字台有什么区别?

如果我执行清除这样的命令来清除屏幕,
shell在哪里找到命令''clear''?
i have a python program which attempts to call ''cls'' but fails:

sh: line 1: cls: command not found

i tried creating an alias from cls to clear in .profile, .cshrc, and
/etc/profile, but none of these options seem to work.
Why not call ''clear'', since ''cls'' does not exist?
my conclusion is that a python program that is executing does not use
the shell (because it does not recognize shell aliases). is this
correct?
Even shell scripts do not normally expand aliases.
should i use a symbolic link? if so, where should i place it?

what is the difference between aliases and symbolic links?
What''s the difference between a raven and a writing desk?
if i execute a command like ''clear'' to clear the screen, where does the
shell look to find the command ''clear''?




在PATH变量中列出的目录中。


-

Chris FA Johnson,作者| < http://cfaj.freeshell.org>

Shell Scripting Recipes:|我在这篇文章中的代码,如果有的话,

问题解决方法|发布于2005年的

,Apress | GNU通用公共许可证



In a directory listed in the PATH variable.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence


这篇关于符号链接,别名,cls清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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