Leap Year Program with Bash Shell Scripting in Windows Last Updated : 02 Mar, 2023 Comments Improve Suggest changes Like Article Like Report Accurately the Earth has 365.24 days per year, to correct the approximation and keep track of the Solar Calendar the idea of leap year has been introduced to Gregorian Calendar. A leap year comes once every four years. In contrast, it has 366 days with regular years, having 365 days. Mathematical approach to check:Every year is a Leap year if it is evenly divided by four.Every year evenly divided by 100 BUT not 400 is not a leap year.Every year evenly divided by 400 is a leap year. Use the following shell script for the same. echo -n "Enter year (YYYY): " read y a = 'expr $y%4' b = 'expr $y%100' c = 'expr $y%400' if [$a -eq 0 -a $b -ne 0 -o $c -eq 0] then echo "$y is leap year" else echo "$y is not a leap year" fi Example: Input: 2024 Output: "2024 is leap year" Time complexity: O(1) because it is doing constant operations Auxiliary space: O(1) Comment More infoAdvertise with us Next Article How to Use Linux Commands in Windows with Cygwin P poornapragnamath Follow Improve Article Tags : Linux-Unix Similar Reads Calculator Program with Batch Scripting in Windows By using the Batch Scripting of command prompt one could even design a normal basic calculator that takes expressions and returns the result. Type the following script in notepad or any other text editor software: @echo off :a echo ________Calculator________ echo. set /p expression= Enter expression 2 min read Bash Script - Write Hello World Program In this article, we are going to see how to write "hello world" program in Bash script. The bash script is a text file that contains a set of instructions ( i.e. codes or commands ) that can be executed in the terminal. In any programming language, the first program that we learn to write is " Hello 2 min read How to Run a Shell Script in Linux Shell scripts are a powerful way to automate tasks and manage system processes in Linux. These scripts, written in shell programming languages like Bash, allow users to execute a sequence of commands efficiently. In this guide, we'll show the steps to check a shell script in Linux before running it, 4 min read How to Use Linux Commands in Windows with Cygwin Cygwin is a collection of tools that provide a Linux Operating System's terminal look, feel, and some of its basic functionality for users of Windows OS who want to have a go over the basic commands of Linux without worrying about installing a Linux OS. To use this tool, first of all, we need to dow 3 min read Bash Scripting - Working of Bash Scripting Bash Scripting is a crucial component of Linux's process automation. You can write a series of commands in a file and then execute them using scripting. A Bash script is a plain text file with a set of commands inside of it. These commands are a combination of ones we typically type on the command l 6 min read Shell Scripting - JOB SPEC & Command Prerequisites: Bash Scripting, Shell Function Library Processes started from the terminal (and still not terminated) get a unique serial number or ID that is known as job spec or job ID. With the help of the job spec of a particular process, we can send signals to it or make that particular process 3 min read Like