EXECUTE Examples


Example 1:

 

  

EXECUTE

"cmd /c del tfile.txt"

(MS-DOS)

  

EXECUTE

"rm TFILE.TXT"

(Linux)

 

The program would be temporarily suspended while the file TFILE.TXT is deleted by the operating system. Normal screen I/O generated by this instruction would appear on the screen.

 

Note that since the "del" command is a part of the Windows shell, "cmd" must be loaded. The name of the command shell varies by operating system.

 

Example 2:

 

  

EXECUTE

"cmd /c del tfile.txt > NUL"

(MS-DOS)

  

EXECUTE

"rm TFILE.TXT > /dev/null"

(Linux)

 

The program would be temporarily suspended while the file TFILE.TXT is deleted by the operating system. However, normal screen I/O generated by this instruction would be redirected to the null system file and not appear on the screen or be stored in a file on disk.

 

Note that since the "del" command is a part of the Windows shell, "cmd" must be loaded. The name of the command shell varies by operating system.

 

Example 3:

 

  

EXECUTE

"cmd /c dir *.* >dirfile.txt"

(MS-DOS)

  

EXECUTE

"ls *.* > DIRECTRY"

(Linux)

 

The use of the greater than sign `>' tells the operating system that the screen I/O normally attributed to the instruction is redirected (not shown on the CRT) into the file `dirfile.txt'.

 

Note that since the "dir" command is a part of the Windows shell, "cmd" must be loaded. The name of the command shell varies by operating system.

 



PL/B Language Reference ERASE Example EXP Example