Special Commands
特殊命令是 .
名为命令组的一部分。
Special commands are part of a command group named .
OS Shell command
.!
命令在您启动 Shell 的目录中运行一个 OS 命令。此命令仅在交互模式下起作用。
The . !
command runs an OS command in the directory where you started the shell.
This command works only in interactive mode.
如果您运行命令遇到困难,您可能需要使用双引号将其括起来。但是,之后您可能需要使用单引号替换命令中的任何双引号。这可能有些有趣,因此不要将此功能推得太远,实践中它适用于通常的日常任务。 |
If you have difficulty running the command, you may want to try surrounding it with double quotes. However, then you would likely need to replace any double quotes within your command with single quotes. It can get funky, so don’t push this functionality too far, in practice it works well with common day-to-day tasks. |
对于 Unix 或 Mac,它运行 bash -c
。对于 Windows,它运行 cmd /c
。
For Unix or Mac, it runs bash -c
. For Windows, it runs cmd /c
.
Examples
要列出当前目录的内容:
To list the contents of the current directory:
spring:>. ! ls
LICENSE mvnw mvnw.cmd pom.xml README.adoc src target
要显示一个文件内容:
To show the contents of a file:
spring:>. ! more LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
< omittied ... >
要搜索文件:
To search for files:
spring:>. ! find . -name "*.java" -print
./src/main/java/com/example/restservice/Application.java
./src/main/java/com/example/restservice/greeting/GreetingController.java
./src/main/java/com/example/restservice/greeting/Greeting.java
./src/test/java/com/example/restservice/greeting/GreetingControllerTests.java
./.spring/commands/controller/new/RestController.java
spring:>. ! ./mvnw clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.example:rest-service >----------------------
[INFO] Building rest-service 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
< omitted ... >