Special Commands

Special commands are part of a command group named .

OS Shell command

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.

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