# वेरिएबल्स और कंडीशनल्स — Linux Command Line Fundamentals

Source: https://www.skillbyai.com/hi/linux/linux-bash-variables-conditionals

> Bash scripts में variables में values रखें और if, else व file tests से branching करें।

## वेरिएबल्स

`=` के आस-पास कोई स्पेस नहीं। `$name` से वेरिएबल का मान पढ़ें।

```bash
name="Bob"
count=3
echo "$name has $count files"
```

Output:

```
Bob has 3 files
```

## if / else

टेस्ट एक्सप्रेशन `[ ]` के अंदर आता है (स्पेस मायने रखता है)। `-f` जाँचता है कि फाइल मौजूद है।

```bash
if [ -f "notes.txt" ]; then
    echo "File exists"
else
    echo "Not found"
fi
```

Output:

```
File exists
```
