Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create a wrapper script for the Flatpak version of Octave, to avoid the long command flatpak run org.octave.Octave?

In the apt version of octave, I can use the command octave script.m to execute the file script.m. Similarly flatpak run org.octave.Octave script.m works too.

However, to avoid the long command flatpak run org.octave.Octave, I created a file ~.local/bin/octave with the contents flatpak run org.octave.Octave, and marked it as executable (I already removed the apt version of Octave). While it runs octave just fine, octave script.m does not work anymore, it only opens the command line version of Octave.

I know that I can open Octave and run the script from within, but I am interested to know if the script can be directly run from terminal with the flatpak version of Octave.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I have just installed Octave 6.4.0 from Flatpak on my Ubuntu 20.04.3 LTS system, then rebooted and I’m able to execute my script.m file from terminal from both MATE and GNOME as simple as:

flatpak run org.octave.Octave script.m

Or create a wrapper script by

cat <<'EOF' | tee ~/.local/bin/octave
#!/bin/bash
flatpak run org.octave.Octave "$@"
EOF

chmod +x ~/.local/bin/octave

and call Octave from Flatpak by executing octave script.m. Make sure that ~/.local/bin is defined in your $PATH variable.

Note: make sure that you do not have both deb- and Flatpak-versions of Octave. Remove the first by sudo apt-get autopurge octave if you prefer Flatpak.


If Flatpak fails on your system, you can install Octave 6.4.0 from some PPA by executing below commands:

sudo add-apt-repository ppa:devacom/science
sudo apt-get update
sudo apt-get install octave
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading