Bash Developer Hiring Guide

Hiring Guide for Bash Engineers

Ask the right questions to secure the right Bash talent among an increasingly shrinking pool of talent.

Bash, an acronym for Bourne Again SHell, is a Unix shell and command language created by Brian Fox for the GNU Project in 1989. It is a free software replacement for the Bourne shell (sh), originally developed by Stephen Bourne for AT&T's Unix version 7 in 1979. Bash is a powerful programming language, providing complete control over UNIX/Linux systems, and is widely used for its command line interface (CLI) scripting capabilities. It is the default shell for most UNIX systems, including Linux and macOS, and has been ported to Microsoft Windows and distributed with Cygwin and MinGW. Bash's features include programmable command-line completion, command-line editing, and a history mechanism.

First 20 minutes

General Bash knowledge and experience

The next 20 minutes of the interview should attempt to focus more specifically on the development questions used, and the level of depth and skill the engineer possesses.

How would you write a conditional statement in Bash?

A conditional statement in Bash can be written using if, then, else, and fi. For example: if [ $a -gt $b ]; then echo 'a is greater than b'; else echo 'b is greater than a'; fi.

What is the purpose of the 'echo' command in Bash?

The 'echo' command in Bash is used to print output to the terminal. It can be used to display text or the value of a variable.

How would you write a for loop in Bash?

A for loop in Bash can be written as follows: for i in {1..10}; do echo $i; done. This will print the numbers 1 to 10.

What are the basic data types in Bash?

Bash only supports one data type, which is a string. Even when you are using numbers, they are still treated as strings.

How would you create a variable in Bash?

You can create a variable in Bash by using the equals sign with no spaces, like this: variableName=value.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

What youre looking for early-on

Has the candidate demonstrated the ability to work on complex Bash scripts?

This will show if the candidate can handle the complexity of the tasks they will be given.

Did the candidate express familiarity with common Bash scripting pitfalls and how to avoid them?

This shows that the candidate has in-depth knowledge and experience.

Was the candidate able to explain how they would automate tasks using Bash?

This is a common use of Bash scripting and shows practical knowledge.

Does the candidate have experience with shell script debugging?

Debugging is a key skill in any software development role, including Bash scripting.

Did the candidate demonstrate understanding of Linux/Unix shell environments?

Bash scripting is often used in these environments, so familiarity with them is important.

Has the candidate shown knowledge of Bash scripting syntax and commands?

This is crucial as the candidate will be writing and dealing with scripts on a daily basis.

Next 20 minutes

Specific Bash development questions

The next 20 minutes of the interview should attempt to focus more specifically on the development questions used, and the level of depth and skill the engineer possesses.

How would you handle errors in a Bash script?

Errors in a Bash script can be handled using the 'set' command with the '-e' option, which causes the script to exit when a command fails. You can also use conditional statements to check the status of a command and take appropriate action.

Describe the difference between 'source' and '.' in Bash.

'source' and '.' are both commands in Bash that are used to read and execute commands from a file in the current shell environment. There is no difference between them except for their name.

What are the different ways to execute a Bash script?

A Bash script can be executed by either giving it execute permissions using the chmod command and then running it directly, or by passing the script name as an argument to the Bash command.

How would you pass arguments to a Bash script?

Arguments can be passed to a Bash script after the script name, separated by spaces. Inside the script, they can be accessed as $1, $2, etc.

Describe the difference between a function and a script in Bash.

A script is a file that contains a sequence of commands for a Unix-based operating system. A function, on the other hand, is a group of commands that is given a name and can be called from anywhere within the script.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

The ideal back-end app developer

What you’re looking to see on the Bash engineer at this point.

At this stage, the candidate should demonstrate advanced bash scripting knowledge, problem-solving ability, and experience with Unix/Linux systems. Red flags include inability to explain commands or scripts in detail, lack of understanding of system processes or over-reliance on tools without understanding underlying principles.

Digging deeper

Code questions

These will help you see the candidate's real-world development capabilities with Bash.

What does the following simple bash script do?

#!/bin/bash

 echo 'Hello, World!'

This bash script prints 'Hello, World!' to the console.

What will be the output of the following bash script?

#!/bin/bash

var='Hello, World!'
echo $var

The script will output 'Hello, World!'. The variable 'var' is assigned the string 'Hello, World!', which is then printed to the console.

What does the following bash script do with an array?

#!/bin/bash

array=('one' 'two' 'three')
for i in "${array[@]}"
do
  echo $i
done

This script creates an array with three elements 'one', 'two', and 'three'. It then iterates over each element in the array and prints it to the console.

What does the following bash script do related to threading or concurrency?

#!/bin/bash

(echo 'Hello, World!' &)

This script runs the command 'echo 'Hello, World!'' in the background as a separate process. The parentheses create a subshell for the command, and the ampersand '&' causes the command to run in the background.

What does the following bash script do related to class design or class object?

#!/bin/bash

: ${CLASS:=DefaultClass}
: ${METHOD:=defaultMethod}

$CLASS() {
  $METHOD() {
    echo 'Hello, World!'
  }
}

$CLASS
$METHOD

This script creates a 'class' and a 'method' in bash, which are actually just functions. The 'class' is named 'DefaultClass' and the 'method' is named 'defaultMethod'. The method when called prints 'Hello, World!' to the console.

What will be the output of the following advanced bash script?

#!/bin/bash

function func() {
  local temp=$[ $value + 5 ]
  result=$[ $temp * 2 ]
}

value=4
func
echo $result

The script will output '18'. The function 'func' is defined, which calculates a new value for 'result' based on the input 'value'. 'value' is set to '4', then 'func' is called, and finally 'result' is printed to the console.

Wrap-up questions

Final candidate for Bash role questions

The final few interview questions for a Bash candidate should typically focus on a combination of technical skills, personal goals, growth potential, team dynamics, and company culture.

What are the different ways to read input in a Bash script?

Input can be read in a Bash script using the 'read' command, which reads a line from the standard input and splits it into words. These words can then be stored in variables. Another way to read input is by using command line arguments.

How would you write a Bash script that runs in the background?

You can make a Bash script run in the background by appending an ampersand (&) to the end of the command that runs the script. You can also use the 'nohup' command to ensure that the script continues running even if the terminal is closed.

Describe the difference between '$*' and '$@' in Bash.

Both '$*' and '$@' are used to refer to all arguments passed to a script. The difference is in how they handle arguments that contain spaces. '$*' treats the entire set of positional parameters as a single string, while '$@' treats each argument as a separate string.

How would you debug a Bash script?

You can debug a Bash script by running it with the '-x' option, which prints each command to the terminal before it is executed. You can also use the 'set' command with the '-x' option to enable debugging for part of the script.

What is the purpose of the 'trap' command in Bash?

The 'trap' command in Bash is used to specify commands that will be executed when a signal is received by the script. This can be used to perform cleanup tasks before the script exits.

The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

Bash application related

Product Perfect's Bash development capabilities

Beyond hiring for your Bash engineering team, you may be in the market for additional help. Product Perfect provides seasoned expertise in Bash projects, and can engage in multiple capacities.