2.4. System Commands

The way you execute system commands with the ! (bang) shell escape character will be slightly different for Linux and Windows systems.

2.4.1. System Commands for LINUX-based Operating Systems

If you are running Ansys Fluent under a Linux-based operating system, all characters following the ! up to the next newline character will be executed in a subshell. Any further input related to these system commands must be entered in the window in which you started the program, and any screen output will also appear in that window. (Note that if you started Ansys Fluent remotely, this input and output will be in the window in which you started Cortex.)

!rm junk.*

!vi script.rp

!pwd and !ls will execute the Linux commands in the directory in which Cortex was started. The screen output will appear in the window in which you started Ansys Fluent, unless you started it remotely, in which case the output will appear in the window in which you started Cortex. (Note that !cd executes in a subshell, so it will not change the working directory either for Ansys Fluent or for Cortex, and is therefore not useful.) Typing cd with no arguments will move you to your home directory in the console.

Ansys Fluent includes three system command aliases (pwd, ls, and chdir) that will be executed in your working directory with output displayed in the Ansys Fluent console. Note that these aliases will invoke the corresponding Linux commands with respect to the parent directory of the case file. For example, pwd prints the parent directory of the case file in the Ansys Fluent console, while !pwd prints the directory from which you started Ansys Fluent in the Linux shell window where you started Ansys Fluent.

Several examples of system commands entered in the console are shown below. The screen output that will appear in the window in which Ansys Fluent was started (or, if you started the program remotely, in the window in which Cortex was started) follows the examples.

Example input (in the Ansys Fluent console):

!pwd

!ls valve*.*

Example output (in the window in which Ansys Fluent— or Cortex, if you started the program remotely—was started):

/home/cfd/run/valve
 valve1.cas  valve1.msh  valve2.cas  valve2.msh 

2.4.2. System Commands for Windows-based Operating Systems

If you are running Ansys Fluent under a Windows operating system, all characters following the ! up to the next newline character will be executed. The results of a command will appear in the Ansys Fluent console, or in a separate window if the command starts an external program, such as Notepad.

!del junk.*

!notepad script.rp

!cd and !dir will execute the DOS commands and the screen output will appear in the Ansys Fluent console. The !cd command with no argument will display the current working directory in the Ansys Fluent console.

Several examples of system commands entered in the console are shown below.

Example input (in boxes) and output (in the Ansys Fluent console):

!cd

p:/cfd/run/valve
 > !dir valve*.*/w

     Volume in drive P is users
     Volume Serial Number is 1234-5678
     Directory of p:/cfd/run/valve
     valve1.cas      valve1.msh      valve2.cas      valve2.msh
        4 File(s)              621,183 bytes
        0 Dir(s)          1,830,088,704 bytes free