How to detect the OS from a Bash script

0 votes

I would like to keep my .bashrc and .bash_login files in version control so that I can use them between all the computers I use. The problem is I have some OS specific aliases so I was looking for a way to determine if the script is running on Mac OS X, Linux or Cygwin.

What is the proper way to detect the operating system in a Bash script?

Jun 21 in Linux Administration by Korak
• 5,820 points
13 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Linux Administration

0 votes
0 answers

How to detect the OS from a Bash script?

I would like to keep my .bashrc and .bash_login files in ...READ MORE

Jun 22 in Linux Administration by Korak
• 5,820 points
4 views
0 votes
1 answer

How to find the first field from a file in Bash Shell?

Hi@akhtar, You can extract text from a file. ...READ MORE

answered Oct 20, 2020 in Linux Administration by MD
• 95,360 points
281 views
0 votes
0 answers

How to send control+c from a bash script?

I'm starting a number of screens in ...READ MORE

Jun 16 in Linux Administration by Rahul
• 3,380 points
14 views
0 votes
0 answers
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,210 points
441 views
0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 5, 2020 in Linux Administration by Prakash K. Aithal
1,680 views
0 votes
0 answers

How can I convert a series of images to a PDF from the command line on linux?

I have a scanning server I wrote ...READ MORE

Apr 21 in Linux Administration by Edureka
• 13,640 points
20 views
0 votes
0 answers

Bash script to automate a VPN from vpnbook.com

I wrote a bash script that reads ...READ MORE

May 27 in Linux Administration by Rahul
• 3,380 points
80 views
0 votes
1 answer

Why do you need to put #!/bin/bash at the beginning of a script file?

It's a show so the *nix shell ...READ MORE

answered Jun 20 in Linux Administration by Rahul
• 3,380 points
13 views
0 votes
1 answer

How to find the group associated with a user in linux?

To list all the groups groups or to list ...READ MORE

answered Jun 21, 2019 in Linux Administration by DareDev
• 6,890 points
395 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP