What does the $ mean when running commands?

青春壹個敷衍的年華 提交于 2019-11-29 06:31:54

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.)

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.

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

trm42

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.

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