Bash Flashcards

1
Q

What is Bash, and how does it contribute to developer productivity in a Linux environment like Starling?

A

Bash (Bourne Again Shell) is a Unix shell and command language that plays a crucial role in automating tasks, managing system configurations, and enhancing developer productivity in Linux environments like Starling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are variables in Bash, and how do you declare and use them?

A

Variables in Bash are containers for storing data. You declare them using the syntax variable_name=value and access their values using the $ symbol. Understanding variable scope, naming conventions, and variable expansion is important for effective script writing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you create and execute a basic Bash script?

A

To create a Bash script, you typically start with a shebang line (#!/bin/bash) followed by your script commands. After saving the script with a .sh extension, you can execute it using the bash interpreter or by making it executable and running it directly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you handle user input in a Bash script?

A

User input can be captured using the read command in Bash. Understanding how to prompt users for input, validate input, and handle user responses is crucial for creating interactive Bash scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are command-line arguments in Bash, and how do you handle them in scripts?

A

Command-line arguments are values passed to a script when it’s executed. Learning how to access and process command-line arguments using special variables like $1, $2, and $@ is essential for creating versatile and customizable scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you redirect input, output, and errors in Bash?

A

Redirection operators, such as >,&raquo_space;, <, and |, allow you to manipulate input, output, and error streams in Bash. Understanding how to redirect data between files, commands, and streams is essential for efficient I/O handling in scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how to assign execute permissions to the script

A

chmod +x <name></name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly