Linked Questions

5 votes
3 answers
3k views

I need to make script that behaves differently per system. Today it is possible to run bash even on microsoft windows, mac, linux, hp-ux, solaris etc... How can I determine which of these operating ...
Petr's user avatar
  • 14.7k
0 votes
1 answer
609 views

I know there is, for example, hostnamectl command on linux and system_profiler SPSoftwareDataType command on macOS to know the operating system version, but I'm looking for a command that works for ...
AlessioF's user avatar
  • 453
1686 votes
15 answers
1.0m views

Is there a standard Bash command that acts like echo but outputs to stderr rather than stdout? I know I can do echo foo 1>&2 but it's kinda ugly and, I suspect, error-prone (e.g. more likely to ...
BCS's user avatar
  • 79.2k
488 votes
11 answers
250k views

I have a shell script that is used both on Windows/Cygwin and Mac and Linux. It needs slightly different variables for each versions. How can a shell/bash script detect whether it is running in ...
bastibe's user avatar
  • 17.3k
133 votes
14 answers
74k views

Is it possible to write a single script file which executes in both Windows (treated as .bat) and Linux (via Bash)? I know the basic syntax of both, but didn't figure out. It could probably exploit ...
Ondra Žižka's user avatar
51 votes
3 answers
39k views

I am trying to use base64 but the script doesn't run successfully in Ubuntu machine MYCOMMAND=$(base64 commands.sh) So in Ubuntu , I have to use MYCOMMAND=$(base64 -w0 commands.sh) unfortunately ...
ambikanair's user avatar
  • 4,730
21 votes
8 answers
68k views

I am writing a bash shell script in Linux, this program will accept a date (mm-dd-yyyy) as a parameter. I am wondering if there is a simply way to check if the date is valid? is there an operator and ...
Gary's user avatar
  • 4,765
28 votes
5 answers
29k views

On Windows, if I start c:\msys64\mingw64.exe, it opens a shell, where I can build my project, let's say by calling a release bash script (to simplify). Everything works fine. Now, I would like to ...
rom1v's user avatar
  • 3,049
18 votes
5 answers
33k views

What would be the way to determine the current OS a Jenkins pipeline is running? Context: I'm building a shared Jenkins pipeline script that should run on all platforms (windows, OSX, linux) and ...
FedeN's user avatar
  • 416
11 votes
3 answers
26k views

Hi I'm new to bash scripting. Just wrote this simple program but it is throwing error. #!/bin/bash os=`uname -o` echo $os if ["$os"=="GNU/Linux"] ; then echo "Linux" else echo "Windows" fi ...
Reuben's user avatar
  • 5,756
22 votes
3 answers
19k views

I added bash on windows to windows terminal by editing the settings.json file, when I try to compile a simple hello world written in c++ it throws an error that gcc or g++ is not detected How to ...
RAT's user avatar
  • 299
33 votes
3 answers
30k views

I'm trying to find out where I can find documentation on POSIX functions, but coming up short. Any recommendations?
user avatar
7 votes
3 answers
12k views

How to find the operating system using bash script? I found this answer: Detect the OS from a Bash script. It is not clear it would work on Mac OS X. I would like to find it on Mac OS X vs different ...
ssk's user avatar
  • 9,355
9 votes
3 answers
5k views

Issue Question is as stated in the title. In gist, I am trying to get my bash scripts and Vim to behave differently when running in VS Code's integrated terminal. Things I've found I have managed ...
yongjieyongjie's user avatar
15 votes
2 answers
9k views

I use several different OS's at home and work and I want to be able to load platorm-specific ZSH settings conditionally, depending on which OS I'm using at the given moment. I tried this but it doesn'...
dzhi's user avatar
  • 1,694

15 30 50 per page