Parameter on start


#1

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?


#2

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.


#3

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.


#4

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


#5

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.


#6

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?


#7

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.


#8

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.


#9

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

#!program --arg1 --arg2=foo

#10

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


#11

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


#12

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.


#13

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.


#14

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.