(Note: We may earn commissions from products/services you click on. This is at no extra cost to you.)
Table of Contents
Yes, Bash is cross-platform. Do you have any doubts in regards to this? Or do you lack any ideas in regards to Bash being cross-platform?
Regardless of your situation, the first thing that you need to accept is that Bash is considered as cross-platform, and we are going to discuss the reason below if, by any chance, you doubt this statement.
Have you ever heard of C or even used it to perform certain operations? Well, we are going to use C as a programming language to answer this question.
If you have at one point used the C programming language, you must have noticed that Bash is already a C-based cross-platform file manipulation library.
Upon allowing the use of arbitrary libraries, you will absolutely find one that will perform whatever you want on every platform that you are targeting.
You can become a data scientist – click this affiliate link to register for the Data Science Certification Course using R.
Click this affiliate link now to register for Python Certification Training and boost your career to the next level.
Become a Java expert – click this affiliate link to register for Comprehensive Java Course Certification Training


What is a cross-platform shell?
What is a shell in the first case before you try to answer what a cross-platform is? Well, a shell is simply a command-line (text input/output) or even a graphical interface that allows you to integrate with the programs in the operating system.
In other words, the shell program is simply the outer layer of the operating system’s kernel, and that’s where the name shell is derived.
A platform is an environment that the programming code is executed in. There are only two major types of platforms.
The two major types of platforms are:
- Hardware – this will always vary based on several things such as the hardware architecture features, CPU, GPU, and many others related to the listed examples.
- Software – this one will also vary based on the OS, browser, or the execution runtimes such as Java or .NET.
A cross-platform code is simply an executable code that operates on several different platforms without significant changes.
So, from the general definition of what a shell is generally, you can apply the same definition in identifying what a cross-platform is. If you can’t still craft your own definition from that, then you need to know that a cross-platform shell is the outside part of a program that integrates different platforms together and doesn’t undergo significant changes.
Software Platforms, when grouped, include:
- Desktop – Windows, Unix, Mac OS
- Browser – Chrome, Firefox, Safari, Opera, and IE
- Mobile – Android, IOS, Windows Phone
- Game Consoles – PlayStation, Xbox, and Nintendo
- Server – Unix and Windows Server
- Others include – Smart TV, SmartWatch and Cameras among several others
What are some of the most common Cross-platform languages that you need to know of? Well, they are not limited to:
- Java
- C++
- JavaScript
Now, have you ever used the MacOS/Linux terminal or CMD and even PowerShell that’ son Windows? If you replied to that with a yes, then several people will always call it the shell.
In addition to that, technically, a program that is always used to open up the window that you are typing into is most likely to be a terminal terminator; however, the program that is running inside, allowing your input is the shell.
The shell will always enable you to interact with programs that work on the file system, system operations, all devices that add up to the entire system you are using, and many others.
Again, in other cases, you are also capable of communicating with several other different machines over SSH, popularly known as Secure Shell.
You can become a data scientist – click this affiliate link to register for the Data Science Certification Course using R.
Software developers and IT professionals always use shells for several tasks that are not limited to:
- Batch processing files
- Running custom scripts
- Searching the file system
- Downloading and even uploading files to the Internet
- Playing games
- Automating all their daily workflows
So what are the most popular examples of the command-line shells that you know of? Well, if you have no idea, then check below:
- Bourne Shell (sh)
- Bash (Bourne –again Shell)
- Korn Shell
- PowerShell
- Fish
- Zsh
- Csh
However, if you are thinking of a common graphical (GUI) shell example, then you need to know of Windows. There are several others that you can find out about.
Click this affiliate link now to register for Python Certification Training and boost your career to the next level.
Are shell scripts cross-platform?
Before we jump into answering the question as to whether shell scripts are cross-platform or not, you need to be able to define what shell scripts are and also understand how they work, isn’t that so?
A shell script is a computer program that is built to be run by the Unix shell, which is the command-line interpreter.
Now that you know that, you now need to know that several different dialects of shell scripts are always recognized as the scripting languages.
From the above explanation, we can conclude that shell scripts are among the examples of cross-platform shells. Other examples that you can know include:
- Secure shell (SSH)
- Wget
- DD
- Ping
- Curl
- Netstat
- Mkdir
- Cd
- Tail
- Sort
Generally, what are the operations that are executed by the shell scripts that you know of?
Well, if you have no answer to the above question, then you need to know of some of them such as:
- File manipulation
- Program execution
- Printing text
- Many others
You also need to know that a script that sets the entire environment runs the program and also conducts other needed operations such as cleanup, logging, and many others is known as a wrapper.
For you to understand that shell scripts are cross-platform, then you can reread what we discussed in the first part of this article.
What is a shell in the first case before you try to answer what a cross-platform is? Well, a shell is simply a command-line (text input/output) or even a graphical interface that allows you to integrate with the programs in the operating system.
In other words, the shell program is simply the outer layer of the operating system’s kernel, and that’s where the name shell is derived.
So from the definition of what a shell is generally, you can apply the same definition in identifying what a cross-platform is. If you can’t still craft your own definition from that, then you need to know that a cross-platform shell is at the outside part of a program that integrates different platforms together.
Now, have you ever used the MacOS/Linux terminal or CMD and even PowerShell that son of Windows? If you replied to that with a yes, then several people will always call it the shell.
In addition to that, technically, a program that is always used to open up the window that you are typing into is most likely to be a terminal terminator; however, the program that is running inside, allowing your input is the shell.
The shell will always enable you to interact with programs that work on the file system, system operations, all devices that add up to the entire system you are using, and many others.
Click this affiliate link to register for Machine Learning using Python Training and Certification.
Is Bash only for Linux?
If, by any chance, someone surprisingly asks you whether Bash is only for Linux, what would be your best answer to that given question?
If you wouldn’t give any answer and simply admit that you don’t know whether Bash is only for Linux or for others, too, you first need to understand what Bash is and how it works or how it is used.
Bash is a UNIX shell and command language that was written by Brian Fox for the GNU Project simply as a free software replacement for the Bourne shell.
If you keenly study its history, you will notice that it was initially released in the year 1993, and since then, it has always been used as the default login shell for nearly all the Linux distributions across the globe.
However, besides being used in nearly all Linux distributions across the globe, there is also a version that is available for Windows 10 users through the Windows Subsystems for Linux.
In addition to that, you also need to be aware that Bash is also used as the default user shell in Solaris.
Lastly, you can also know that Bash was also used as the default shell in all the versions of Apple macOS before the year 2019 where Apple released to the public macOS Catelina, which made changes in the default shell, making zsh as the default shell. Although the default shell in Apple macOS is the zsh shell, Bash still remains as the alternative shell that one can choose to use.
From the above-detailed explanation from the definition up to giving other areas where Bash is used and even where it was used in the older years, it is clear that Bash is not only for Linux since there are several other versions that cover other operating systems that you might know of.
The perception that Bash is only for Linux can be a result of it being made the default shell in nearly all the Linux distributions across the globe. This might have made people think that it’s only available for Linux.
You can become a data scientist – click this affiliate link to register for the Data Science Certification Course using R
What is a cross-platform scripting language?
Can you offer a detailed answer when asked to define and even list some of the examples of the cross-platform scripting languages?
If you can’t either define and even list down some of the examples, or if you can only define and fail to list some of the examples, then you need to continue reading so as to know both of the two.
Click this affiliate link to register for Machine Learning using Python Training and Certification.
To understand this, you first need to remind yourself or know about the scripting languages and some of the examples, right?
This gets us back to the earlier section of this article, where we discussed scripting languages in relation to the shell.
In case you skipped that part, here’s all that you need to know.
A shell script is a computer program that is built to be run by the Unix shell, which is the command-line interpreter.
Now that you know that, you now need to know that several different dialects of shell scripts are always recognized as the scripting languages.
From the above explanation, we can conclude that shell scripts are among the examples of cross-platform shells. Other examples that you can know include:
- Secure shell (SSH)
- Wget
- DD
- Ping
- Curl
- Netstat
- Mkdir
- Cd
- Tail
- Sort
Generally, what are the operations that are executed by the shell scripts that you know of?
Well, if you have no answer to the above question, then you need to know of some of them such as:
- File manipulation
- Program execution
- Printing text
- Many others
You also need to know that a script that sets the entire environment runs the program and also conducts other needed operations such as cleanup, logging, and many others is known as a wrapper.
For you to understand that shell scripts are cross-platform, then you can reread what we discussed in the first part of this article.
What is a shell in the first case before you try to answer what a cross-platform is? Well, a shell is simply a command-line (text input/output) or even a graphical interface that allows you to integrate with the programs in the operating system.
In other words, the shell program is simply the outer layer of the operating system’s kernel, and that’s where the name shell is derived.
So from the general definition of what a shell is generally, you can apply the same definition in identifying what a cross-platform is. If you can’t still craft your own definition from that, then you need to know that a cross-platform shell is the outside part of a program that integrates different platforms together.
Now, have you ever used the MacOS/Linux terminal or CMD and even PowerShell that’ son Windows? If you replied to that with a yes, then several people will always call it the shell.
In addition to that, technically, a program that is always used to open up the window that you are typing into is most likely to be a terminal terminator; however, the program that is running inside, allowing your input is the shell.
The shell will always enable you to interact with programs that work on the file system, system operations, all devices that add up to the entire system you are using, and many others.
Click this affiliate link to register for Machine Learning using Python Training and Certification.
Cross-platform scripting
So, what do you need to know about cross-platform scripting?
You can be filled up by writing and even maintaining tons of Command Line scripts (shell/batch) for several platforms such as Ubuntu, Windows, and even Mac, isn’t that so?
Have you ever heard of any solution to the above situation? If no, then you need to apply the solution that we are going to discuss below.
The solution that we are going to use to fix all this is implemented in the Node.js so as to make things easier on your end – Shelljs.
During this, you will have to ensure that a single copy of the script runs on the entire platform, and also, it doesn’t make gaining expertise in several scripting languages being difficult or altered.
What will you need to achieve this and make the solution works for you?
Well, the first things that are needed so as to apply this solution include:
- Shell Scripting knowledge
- Basic JavaScript knowledge
Besides that, you will need tools to conduct this fix. These tools are not limited to:
- Node.js
- Npm (This comes bundled along with the Node.js)
The last thing that you will need so as to apply this solution is the type of setup. And below is what you need to lastly do so as to apply your fixes:
- Create a directory for the scripts project
- Navigate to the scripts project directory
- Start the npm in the initial project by the use of npm init. Enable all the default values by simply pressing enter at every step
- Install the shelljs as an npm dependency
mkdir shell-scripts
cd shell-scripts/
npm install –save shelljs
npm init
- A package.json file will then be built in the directory
{ “name”: “shell-scripts”,
“version”: “1.0.0”, “description”: “”, “main”: “index.js”,
“scripts”: {
“test”: “echo \”Error: no test specified\” && exit 1″ }, “author”: “”, “license”: “ISC”, “dependencies”: { “shelljs”: “^0.8.3” }}
- Upon completing all that, now you are done.
So, scripting generally has the basic commands, which are not limited to pwd, cd, echo, and also mkdir.
In relation to that, here’s a program that you can use to show you all the commonly used commands.
Output:
shell-scripts harshitsinha$ node test_script.jsCurrent Directory /Users/harshitsinha/Desktop/random_tests/shell-scriptsNavigating to temp folder inside current directoryNew Current Directory /Users/harshitsinha/Desktop/random_tests/shell-scripts/tempNavigating back to project rootCurrent Directory /Users/harshitsinha/Desktop/random_tests/shell-scriptsFiles/Folders in Directory /Users/harshitsinha/Desktop/random_tests/shell-scripts- node_modules- package.json- temp- test_script.jsMaking a directory name tempDir
Other commands that you can know of include grep, cp, cat, and also sed.
Output:
shell-scripts$ node test_script2.jsGrepped lines with word total
Line – total is used for testing purposes
Line – We will again drop a total here
Line -Copying file ./temp/file1.txt to ./temp/file1-copy.txtReplacing in place all occurences of ‘if’ with ‘but’ in fileDisplaying text of file using cat
Hi this is a sample text file
total is used for testing purposes
We will again drop a total here.
If we can keep on continuing this difficult process, we will have a good test example.
Grep lines with word ‘total’ from ./temp/file1.txt, then replace ‘total’ with ‘totalReplaced’ then output final file to ./temp/out.txt.
Dive right in and never stop learning! Click this affiliate link to register for AI and Deep Learning with TensorFlow Certification.
Cross-platform shell script
Do you know or perhaps even understand one simple thing about the cross-platform shell script?
If you have no idea, we earlier discussed this in the previous sections of this article.
Here’s everything that you missed in regards to the cross-platform shell script.
You can be filled up by writing and even maintaining tons of Command Line scripts (shell/batch) for several platforms such as Ubuntu, Windows, and even Mac, isn’t that so?
Have you ever heard of any solution to the above situation? If no, then you need to apply the solution that we are going to discuss below.
The solution that we are going to use to fix all this is implemented in the Node.js so as to make things easier on your end – Shelljs.
During this, you will have to ensure that a single copy of the script runs on the entire platform, and also, it doesn’t make gaining expertise in several scripting languages being difficult or altered.
What will you need to achieve this and make the solution works for you?
Well, the first things that are needed so as to apply this solution include:
- Shell Scripting knowledge
- Basic JavaScript knowledge
Besides that, you will need tools to conduct this fix. These tools are not limited to:
- Node.js
- Npm (This comes bundled along with the Node.js)
The last thing that you will need so as to apply this solution is the type of setup. And below is what you need to lastly do so as to apply your fixes:
- Create a directory for the scripts project
- Navigate to the scripts project directory
- Start the npm in the initial project by the use of npm init. Enable all the default values by simply pressing enter at every step
- Install the shelljs as an npm dependency
mkdir shell-scripts
cd shell-scripts/
npm install –save shelljs
npm init
- A package.json file will then be built in the directory
{ “name”: “shell-scripts”,
“version”: “1.0.0”, “description”: “”, “main”: “index.js”,
“scripts”: {
“test”: “echo \”Error: no test specified\” && exit 1″ }, “author”: “”, “license”: “ISC”, “dependencies”: { “shelljs”: “^0.8.3” }}
- Upon completing all that, now you are done.
So, scripting generally has the basic commands, which are not limited to pwd, cd, echo, and also mkdir.
In relation to that, here’s a program that you can use to show you all the commonly used commands.
Output:
shell-scripts harshitsinha$ node test_script.jsCurrent Directory /Users/harshitsinha/Desktop/random_tests/shell-scriptsNavigating to temp folder inside current directoryNew Current Directory /Users/harshitsinha/Desktop/random_tests/shell-scripts/tempNavigating back to project rootCurrent Directory /Users/harshitsinha/Desktop/random_tests/shell-scriptsFiles/Folders in Directory /Users/harshitsinha/Desktop/random_tests/shell-scripts- node_modules- package.json- temp- test_script.jsMaking a directory name tempDir
Other commands that you can know of include Grep, cp, cat, and also sed.
Output:
shell-scripts$ node test_script2.jsGrepped lines with word total
Line – total is used for testing purposes
Line – We will again drop a total here
Line -Copying file ./temp/file1.txt to ./temp/file1-copy.txtReplacing in place all occurences of ‘if’ with ‘but’ in fileDisplaying text of file using cat
Hi this is a sample text file
total is used for testing purposes
We will again drop a total here
if we can keep on continuing this difficult process, we will have a good test example.
Grep lines with word ‘total’ from ./temp/file1.txt, then replace ‘total’ with ‘totalReplaced’ then output final file to ./temp/out.txt.
Cross-platform powershell
In the recent announcements made by the PowerShell team, one of the important announcements that you need to be aware of is that it’s going open-source and also that it’s currently available on Windows, Mac, and even Linux.
What do you need to understand about this specific announcement?
The first thing that you need to understand is that PowerShell now being present on Linux and also in macOS, and it doesn’t target at replacing all the entire shell experiences of the mentioned operating systems; it will result in easier collaboration across teams that have mixed environments.
Click this affiliate link to register for Machine Learning using Python Training and Certification.
Cross-platform powershell script
You need to know that some few years back, PowerShell scripts could only run on only Windows machines.
As you read this article, you need to be aware that a PowerShell script that is intended for a Windows machine is more likely to fail on a Linux machine. And again, the opposite of that statement is also true.
Another thing that you need to know that you might consider as being worse is the fact that when you try to use a PowerShell on a conflicting platform that it wasn’t intended for, you will notice that some of the commands in your script will surprisingly work, but again, others that are unsupported will trigger errors.
The end results that you are likely to get are, however, unpredictable, and also, on some occasions, they can lead to causing damage to your computer.
Due to the above-mentioned drawbacks, it’s vital to create PowerShell scripts that are either cross-platform or even those that prevent the code from running on an unintended platform.
Nutshell
In the first case, what is a Nutshell?
Well, Nutshell is a growth software platform that aids sales and even marketing teams to collaborate so as to win more deals. Again, Nutshell provides several things to business teams such as:
- Easy to use CRM
- Sales automation
- Email marketing features
- Unlimited data storage
- Top class live support
Again, you need to know that Nutshell Marketing easily combines with your CRM data, which simply means that you are capable of creating custom audiences within a minute and also make all your sales and even marketing outreach using one tool.
Become a Java expert – click this affiliate link to register for Comprehensive Java Course Certification Training
You can become a data scientist – click this affiliate link to register for the Data Science Certification Course using R.

Luis Gillman
Hi, I Am Luis Gillman CA (SA), ACMA
I am a Chartered Accountant (SA) and CIMA (SA) and author of Due Diligence: A strategic and Financial Approach.
The book was published by Lexis Nexis on 2001. In 2010, I wrote the second edition. Much of this website is derived from these two books.
In addition I have published an article entitled the Link Between Due Diligence and Valautions.
Disclaimer: Whilst every effort has been made to ensure that the information published on this website is accurate, the author and owners of this website take no responsibility for any loss or damage suffered as a result of relience upon the information contained therein. Furthermore the bulk of the information is derived from information in 2018 and use therefore is at your on risk. In addition you should consult professional advice if required.