The B4P interactive mode provides direct access to operating system commands. Simply begin the OS commands wiht a dollar sign $ in front.
Operating-specific features like redirecting input/output of commands executed as well as piping are obviously supported.
Example | Windows | Linux / MacOS |
---|---|---|
Clear the screen | $ cls | $ clear |
Change drive | $ D: | (not applicable) |
Show current directory | $ cd | $ pwd |
Change directory | $ cd ..\directory | $ cd ../directory |
Open a PDF document | $ start abc.pdf | $ open abc.pdf |
The operating system commands are executed in separate child processes running independently from B4P. However B4P checks the entered commands
for changing and directories (cd, chdir) and will ensure that the working directory in B4P will change accordingly.
Alternatively, you can use the system() function to execute operating system commands. This fuction can also be used in B4P programs.
The following example shows how to enter a sub-directory by name, step out again, and back in using a wildcard. B4P confirms that it has identified the path names and changes the working directory inside B4P, too.
>> $ cd examples
B4P: Verify and resolve path 'examples' ...
OK. Current directory changed to 'C:\Users\Zur Bonsen Georg\Documents\Programme\Beyond4P\B4P_Docu_Maker\examples\'
>> $ cd ..
B4P: Verify and resolve path '..' ...
OK. Current directory changed to 'C:\Users\Zur Bonsen Georg\Documents\Programme\Beyond4P\B4P_Docu_Maker\'
>> $ cd ex*
B4P: Verify and resolve path 'ex*' ...
OK. Current directory changed to 'C:\Users\Zur Bonsen Georg\Documents\Programme\Beyond4P\B4P_Docu_Maker\Examples\'
>> exit