Welcome to the Bash Manual! 📚
Bash (Bourne-Again SHell) is a Unix shell and command language. This guide covers its core features, syntax, and usage scenarios. For deeper exploration, check our Bash Tutorial 📖.
Table of Contents
Introduction
Bash is the default shell for most Linux distributions and macOS. It's a powerful tool for automating tasks and managing systems.
Basic Syntax
- Commands are executed in the terminal:
command arguments
- Pipes (
|
) redirect output to other commands:ps | grep bash
- Redirection operators:
>
writes output to a file<
reads input from a file>>
appends output to a file
Command Execution
- Use
.
to run scripts in the current shell:. script.sh
- Background processes with
&
:sleep 10 &
- Job control with
fg
,bg
, andjobs
Scripting Essentials
- Shebang line:
#!/bin/bash
- Variables:
name="Bash"
- Control structures:
if [ condition ]; then ... fi
for ... in ...; do ... done
while ...; do ... done
Advanced Features
- Arrays:
fruits=("apple" "banana")
- Functions:
greet() { echo "Hello, $1!" }
- Process substitution:
(cmd1) | (cmd2)
For more examples, visit our Shell Scripting Guide. 🌟