MacOS Start B4P Programs as Executables

Prev Next

Starting Hello World - Do the following steps

Make sure that the B4P programs you are creating fulfill follwing two requirements:

  • The mode settings must allow file execution. Use chmod 755 filename.b4p to do so
  • Add the chebang statement at the very beginning of the file: #!/usr/local/bin/b4p. MacOS recognizes the chebang and ensures that B4P and not another interpreter, for example the MacOS shells, is trying to run this program.

Good to know: The "hello world.b4p" file does already fulfilll these two prerequistes.

Note:If B4P is started for the first time, the it will search and memorize the location of the 7-Zip compression utility. This will happen only once after the installation and needs a few seconds of time.

Go into the available B4P directory
[~]$ cd b4p
[b4p]$ ls
'B4P Reference Manual.b4p'   interactive.b4p  'start B4P here.b4p'
'hello world.b4p'            main.b4p
Take a look at 'hello world.b4p'
[b4p]$ cat 'hello world.b4p'
#!/usr/local/bin/b4p

// The statement in the 1st row applies to UNIX/Linux/MacOS only and is called a "Shebang".
// It specifies the interpreter to use when started as an executable file.
// You can delete this line it if you plan to use B4P under Windows only.

// Shebangs are ignored in Microsoft Windows environments.

echo(Hello World);
Run the program
[b4p]$ ./'hello world.b4p'
Note - The 7-Zip utility message occurs only one single time after installation
B4P - Beyond Former Performance
_______________________________________________________________________________

Version 10.00 Release Candidate 2 (2022-03-27)
Copyright (C) 2012..2022 Georg zur Bonsen, all rights reserved.
Licensed info ...

Look for the 7Z compression/decomopression utility

Found following program file paths: {'C:\Program Files','C:\Program Files (x86)'}
 - 7z.exe Zip-utility found in {'C:\Program Files\7-Zip\7z.exe'} (OK)

Hello World
Done - Press ENTER key
[b4p]$
Run the program again, using a wildcard
[b4p]$ ./hello*
B4P - Beyond Former Performance
_______________________________________________________________________________

Version 10.00 Release Candidate 2 (2022-03-27)
Copyright (C) 2012..2022 Georg zur Bonsen, all rights reserved.
Licensed info ...

Hello World
Done - Press ENTER key
[b4p]$