What does the $ mean when running commands?

跟風遠走 提交于 2019-11-27 23:43:19

问题


I've been learning Python, and I keep running into the $ character in online documentation. Usually it goes something like this:

$ python ez_setup.py (Yeah, I've been trying to install setup tools)

I'm fairly certain that this command isn't for the python IDE or console, but I've tried windows cmd and it doesn't work. Any help?


回答1:


As of now, Python does not implement $ in its syntax. So, it has nothing to do with Python.

Instead, what you are seeing is the terminal prompt of a Unix-based system (Mac, Linux, etc.)




回答2:


When you open up command prompt in Windows, you'll see something like:

C:\Users\Michael0x2a\Blah> 

The $ symbol is the equivalent in Linux-based systems.

Whenever you see the $ sign, simply ignore it and type in the rest of the line without modification.




回答3:


The $ is the command prompt. It is used to signify that python ez_setup.py should be run on a command line and not on a python/perl/ruby shell

You might also see % python ez_setup.py, which also means the same thing




回答4:


As the two previous answers told, $ is the beginning of commandline prompt waiting for your input in Unix/Linux -systems. In Windows the similar example notation would be like

C:\> python ez_setup.py

So you don't have to write the dollar sign. Just imagine the beginnings of Windows CMD or Powershell prompt in the beginning of line :)

You can read more discussion about the history of dollar sign from Superuser.



来源:https://stackoverflow.com/questions/19986306/what-does-the-mean-when-running-commands

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