Interview Coding Questions & Answers — Bash

Priyankar Prasad
1 min readNov 7, 2021

--

Bash(Bourne Again Shell) script is one of the popular and commonly used shell programming language. Mostly, bash scripting is used to automate manual or repetitive tasks. It is possible to use multiple shell commands in one bash script and complete a step by step manual task. 90% of the time in technical interviews of DevOps engineer or Linux Systems Engineer or Automation Engineer positions will check on your bash scripting knowledge. Below I have wrote few most commonly asked bash scripting questions.

  1. Copy contents of files named like “FileA.txt, FileB.txt, …” in FolderA and FolderB to FolderC

2. Execute a POST request with provided arguments

3. Find all permutations of a text field

Output :

ABC
ACB
BAC
BCA
CAB
CBA

4. Reverse a String

Output :

DASARP

5. Swap two numbers without using third variable

Output :

10 20
20 10

6. Find the Fibonacci sequence

Output :

0
1
1
2
3

7. Calculate the sum of all the digits in a number

Output :

15

8. Check if a string is a palindrome or not

Output :

Text is a Palindrome

9. Calculate the factorial of a number

Output :

120

I’m planning to update this article when ever I came across some new questions. I hope that this list of interview questions on Bash coding will help you to crack your next job interview. Check my article on Questions of Python codes also.

--

--