# Export and variable

* [export and variable](#export-and-variable)
  * [쉘 변수](#쉘-변수)
  * [export](#export)

## 쉘 변수

```bash
myvar="aaa"
echo $myvar
unset myvar #삭제
echo $myvar

echo $SHELL
```

## export

export 명령어를 통해서 쉘 변수를 환경변수로 저장

```bash
env # aws_profile이 없다.

export AWS_PROFILE=myprofile

env # aws_profile이 생겼다.
```

환경변수가 새로운 터미널을 열면 없어진다.

항상 열고 싶으면 \~/.bashrc 나 \~/.zshrc에 추가해주면 된다.

{% code title="\~/.zshrc" %}

```bash
...
export AWS_PROFILE=myprofile # 추가
```

{% endcode %}

새창을 열고 값을 echo로 확인해본다.

이게 되는 이유는 새창을 열때마다. \~/.zshrc가 실행되기 때문이다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://teamsmiley.gitbook.io/devops/linux/export-and-variable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
