Questions tagged [portability]
The portability tag has no summary.
170 questions
1 vote
3 answers
208 views
How to find the python command in a shell script?
Let's suppose that you have a super python 2&3 one-liner that you need to use in a shell script. On system A the python command works, but on system B you have to use python3, on system C you need ...
1 vote
1 answer
90 views
Is this a portable way to escape MSYS2's Linux paths?
MSYS2-built Linux applications internally rewrite Linux paths to Windows paths. This can be problematic if those are supposed to interface with other, proper-Linux applications (e.g. in my case, MSYS2 ...
1 vote
2 answers
212 views
Would #! /bin/sh - shebang prevent from execution on other operating systems? How to create shell agnostic portable script?
If I include a shebang line in my script like following #! /bin/sh Would it prevent from execution on other operating systems like Windows which may not have sh in bin folder? Is this better to omit ...
6 votes
3 answers
1k views
How can I assign a heredoc to a variable in a way that's portable across Unix and Mac?
This code works fine on Linux but not Mac OS: #!/usr/bin/env bash foo=$(cat <<EOF "\[^"\]+" EOF ) printf "%s" "$foo" It fails on Mac with ./test.sh: line 6: ...
1 vote
1 answer
159 views
How do I adapt a .img clone of my hard disk (1 partition with openSUSE) to another computer?
I have used the dd command to backup my Linux partition (openSUSE Tumbleweed) into a .img file that I saved on an external hard drive. However, I guess dd-ing it on another computer may cause problems,...
1 vote
0 answers
306 views
Custom icons for folders inside drives, should be supported on both Windows and Linux?
I know how to change the icon of a file/folder on Linux (using Dolphin in my case). I know also how to change the icon of a file/folder on Windows 11, both directly in the parameters and using a ...
-1 votes
1 answer
246 views
What is the most portable way to skip arguments for shell scripts?
For portable wrapper scripts intended to run on UNIX systems (not necessarily Linux), should the shift command be preferred over array syntax? #!/bin/sh exec command ${1+"$@"} Compared with:...
-1 votes
1 answer
326 views
Can a bash script add to the context of zsh?
I have recently migrated from bash to zsh. I used to use the following token_refresh.sh script to ssh-add my private key to the session: #!/usr/bin/env bash echo "configuring ssh access.." ...
1 vote
1 answer
324 views
Is POSIX 1e Capabilities widely implemented?
Do somebody know what are the Operating Systems that implemented capabilities (i.e. Posix 1e)? are they compatible? will capabilities reduce portability to Linux only?
0 votes
0 answers
77 views
I have a linux installation on an external drive. How can I plug it into a desktop and have it boot?
Hardware: Laptop [ Daily driver ] Desktop [ Server - Normally has Windows installed ] USB Thumb Drive [ Linux Installation Medium ] External Drive [ Linux Installation Destination ] Situation: ...
1 vote
0 answers
38 views
How to capture and port precise audio configuration/driver/package setup from one Linux distro to another?
I decided to switch to Linux, so I installed Arch (with xfce4). Neither speakers, nor mic worked out of the box. I installed sof-firmware and was able to make speakers work, but not the mic. Meanwhile,...
3 votes
1 answer
493 views
Are VirtualBox guest additions host-independent?
I want to use VirtualBox to set up a stable software environment, which I may then export to other systems running VirtualBox. I also want to install guest additions. Are guest additions host system ...
1 vote
1 answer
637 views
How does nodejs achieve seemingly binary compatibility between different linux distros
If you go to the download site of nodejs you can select Linux Binaries (x64) which is a tar archive that (among other files) contains a bin/ folder with a binary called nodejs. How is nodejs able to ...
2 votes
1 answer
2k views
Is it safe to snprintf with output to NULL and size 0?
Is it safe to call snprintf(NULL, 0, "…", …)? I can also ask in other way: Does snprintf write the NUL char if size is 0? The example in Linux man-pages manpage printf(3) provides an example ...
1 vote
1 answer
279 views
How to hibernate Linux To Go to disk and restore it on a different device?
I have my Linux installed on a portable SSD, so I can switch devices (laptop at home, desktop in office) easily and don't need to consider any syncronization problems. This is called Linux To Go. It's ...