Parameter on start

I can create a link and automated run program on start.

How i can put some options to runed program?
.
How changing terminal first information?

Add a link to the app into ~/config/settings/boot/launch/

Needs the app to be started from Terminal. Or create a script with the command line.

You mean the ā€œWelcome to the Haiku shellā€?
Thatā€™s part of /boot/system/settings/etc/profile. Not sure, but you can try blacklisting that file and provide an alternative in the ā€œnon-packagedā€ hierarchy.

Make a bash script:

#!/usr/bin/env bash
<command> <arguments>

Save it. Make sure to run chmod on it from Terminal to make executable:

chmod +x <script_name>

If you want this script to run at boot, put it in the ~/config/settings/boot/launch directory. You can add as many things as you want to run at start in this script.

Iā€™m pretty sure that the profile in non-packaged overrides the one in system without blacklisting. Since system is read only, this will need to be in the ~/config/settings/non-packaged. I think thatā€™s the correct path from my memory. Iā€™m away from my computer.

this is not a solution, this is only way to run without parameter or parameter inside program

This is a solution, and itā€™s the solution that other OS use to start a program with or without parameters, unless there is a systemwide service controler like initv or systemd.

As far as I am understanding, this is the solution. Perhaps give an example of an actual use case that you need to get working. What programs are you trying to run, with what parameters? How and when do you want them to run?

Maybe thereā€™s some confusion as to how it functions as a solution. The OS executes script files by invoking the processor identified in that top line, when the first two characters are #!. So a script is effectively like any program you may write, and in this way you have the ability to write a program that invokes other programs with the environment and parameters you want.

That processor can be anything that interprets a script with # as a comment line. Python, awk, etc., but usually in practice itā€™s the Bourne shell. Bash is a GNU implementation of the Bourne shell, and reliably available on Haiku, but like any UNIX environment, Haiku also has sh (in this case just bash under a different name.) My shell scripts start with /bin/sh. If you try to run a shell script in an environment where there isnā€™t a /bin/sh, then there wonā€™t be a /usr/bin/env either - but Iā€™m pretty sure you could find UNIXes where bash isnā€™t installed by default.

1 Like

BSD is most notable. Ksh, csh, and tcsh are the popular default ones in that world. Bash is a Linux community preference and of course default in Haiku.

In haiku you can have arguments after the #! so you actually donā€™t need to spawn bash here:

#!program --arg1 --arg2=foo
5 Likes

Meybe add attribute to file and changing it from other program,

That would be my idea as well. The attribute would be editable in Tracker and in the Get Info panel.

1 Like

OT and just FYI:
Bash is not just GNUā€™s implementation of the Bourne shell, itā€™s its successor (simply said). And /bin/sh is not a different shell itself nor ā€˜just bash under a different nameā€™, /bin/sh starts the userā€™s default shell (bash, ksh, tcsh, zsh, etc.) in POSIX mode. So #!/bin/sh and #!/bin/bash (or other) invoke different behaviors. While a script with #!/bin/bash (or other) may include POSIX syntax, a script with #!/bin/sh may not include Bash (or other) syntax.

Itā€™s true that /bin/sh is restricted syntax, but thatā€™s a feature - it supports good programming practice, which is to use standard syntax when possible anyway. Itā€™s the same as invoking bash --posix.

On Haiku, /bin/sh is a symbolic link to bash. Since Haiku (or Linux) arenā€™t likely to ever provide a separate sh, I guess in that sense bash may be considered its successor there, but the same isnā€™t necessarily true on UNIX platforms in general.

Yes and No. /bin/shā€™s syntax shouldnā€™t be called ā€˜restrictedā€™. Itā€™s simply the syntax standardized in POSIX. Shells typically ship their own dialect but can be switched into POSIX mode by using sh or an option like --posix. /bin/sh could be linked to any other shellā€™s binary if that offers a POSIX mode.

Haiku and most GNU/Linux distros use GNU Bash as default shell and the GNU team uses a symlink because their Bash provides a POSIX mode. A separate sh-binary nowadays is only needed when an operating system shall conform the Single UNIX Specification.