# Shell Scripting & Bash (DevOps) > 변수, 루프, 조건문, 함수, 파이프, 리다이렉션 - 20 면접 질문 - Mid-Level - [면접 질문: DevOps](https://sharpskill.dev/ko/technologies/devops/interview-questions.md) ## 1. Bash에서 변수를 선언하는 올바른 구문은 무엇입니까? **답변** Bash에서 변수는 달러 기호 없이, 등호 주위에 공백 없이 선언합니다. 변수 이름은 문자 또는 언더스코어로 시작해야 합니다. 변수의 값을 사용하려면 이름 앞에 달러 기호($)를 붙입니다. 등호 주위의 공백은 Bash가 이를 별도의 명령 인수로 해석하기 때문에 구문 오류를 발생시킵니다. ## 2. Bash에서 USERNAME이라는 변수의 값에 어떻게 접근합니까? **답변** 변수의 값에 접근하려면 이름 앞에 달러 기호($)를 붙입니다. 구문 $USERNAME은 변수에 저장된 값을 검색합니다. 구문 ${USERNAME}도 사용할 수 있으며, 특히 연결이나 수정자 사용에 더 많은 유연성을 제공합니다. 달러 기호가 없으면 Bash는 USERNAME을 변수 참조가 아닌 리터럴 문자열로 해석합니다. ## 3. 자식 프로세스에서 접근할 수 있도록 변수를 내보낼 수 있는 명령은 무엇입니까? **답변** export 명령은 환경 변수를 현재 셸에서 시작된 모든 자식 프로세스에서 사용할 수 있도록 합니다. export 없이는 변수가 현재 셸에 로컬이며 하위 프로세스로 전달되지 않습니다. 이 구분은 다른 스크립트나 프로그램을 호출하는 스크립트를 작성할 때 중요합니다. export VAR=value로 선언과 export를 한 줄에 결합할 수 있습니다. ## 17개 추가 질문 이용 가능 - 마지막으로 실행된 명령의 종료 코드를 어떻게 캡처합니까? - Bash에서 if 조건의 올바른 구문은 무엇입니까? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 DevOps 면접 주제 - [버전 관리 & Git](https://sharpskill.dev/ko/technologies/devops/interview-questions/version-control-git.md): 20개 질문, Junior - [Linux 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/linux-fundamentals.md): 22개 질문, Junior - [네트워킹 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/networking-basics.md): 22개 질문, Junior - [Docker 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/docker-fundamentals.md): 24개 질문, Junior - [CI/CD 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/ci-cd-fundamentals.md): 18개 질문, Junior - [GitHub Actions](https://sharpskill.dev/ko/technologies/devops/interview-questions/github-actions.md): 22개 질문, Mid-Level - [GitLab CI/CD](https://sharpskill.dev/ko/technologies/devops/interview-questions/gitlab-ci.md): 22개 질문, Mid-Level - [Jenkins](https://sharpskill.dev/ko/technologies/devops/interview-questions/jenkins.md): 22개 질문, Mid-Level - [Kubernetes 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/kubernetes-basics.md): 26개 질문, Mid-Level - [Kubernetes 네트워킹](https://sharpskill.dev/ko/technologies/devops/interview-questions/kubernetes-networking.md): 24개 질문, Mid-Level - [Kubernetes 고급](https://sharpskill.dev/ko/technologies/devops/interview-questions/kubernetes-advanced.md): 24개 질문, Mid-Level - [Ingress & API Gateway](https://sharpskill.dev/ko/technologies/devops/interview-questions/ingress-api-gateway.md): 20개 질문, Mid-Level - [Terraform 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/terraform-basics.md): 22개 질문, Mid-Level - [Terraform 고급](https://sharpskill.dev/ko/technologies/devops/interview-questions/terraform-advanced.md): 22개 질문, Mid-Level - [Ansible & Configuration Management](https://sharpskill.dev/ko/technologies/devops/interview-questions/ansible-configuration.md): 20개 질문, Mid-Level - [AWS 핵심](https://sharpskill.dev/ko/technologies/devops/interview-questions/aws-essentials.md): 26개 질문, Mid-Level - [Azure 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/azure-fundamentals.md): 22개 질문, Mid-Level - [GCP 기초](https://sharpskill.dev/ko/technologies/devops/interview-questions/gcp-fundamentals.md): 22개 질문, Mid-Level - [모니터링과 Prometheus](https://sharpskill.dev/ko/technologies/devops/interview-questions/monitoring-prometheus.md): 22개 질문, Mid-Level - [Logging & ELK Stack](https://sharpskill.dev/ko/technologies/devops/interview-questions/logging-elk.md): 20개 질문, Mid-Level - [알림 및 인시던트 대응](https://sharpskill.dev/ko/technologies/devops/interview-questions/alerting-incident-response.md): 20개 질문, Mid-Level - [Cloud Identity & Secrets](https://sharpskill.dev/ko/technologies/devops/interview-questions/cloud-identity-secrets.md): 22개 질문, Mid-Level - [CI/CD 파이프라인 보안](https://sharpskill.dev/ko/technologies/devops/interview-questions/cicd-pipeline-security.md): 20개 질문, Mid-Level - [Helm & Kubernetes](https://sharpskill.dev/ko/technologies/devops/interview-questions/helm-kubernetes.md): 20개 질문, Mid-Level - [런타임 및 클러스터 보안](https://sharpskill.dev/ko/technologies/devops/interview-questions/runtime-cluster-security.md): 24개 질문, Senior - [Container Supply Chain Security](https://sharpskill.dev/ko/technologies/devops/interview-questions/container-supply-chain.md): 22개 질문, Senior - [Service Mesh & Istio](https://sharpskill.dev/ko/technologies/devops/interview-questions/service-mesh-istio.md): 24개 질문, Senior - [GitOps & ArgoCD](https://sharpskill.dev/ko/technologies/devops/interview-questions/gitops-argocd.md): 22개 질문, Senior - [Progressive Delivery](https://sharpskill.dev/ko/technologies/devops/interview-questions/progressive-delivery.md): 20개 질문, Senior - [분산 옵저버빌리티](https://sharpskill.dev/ko/technologies/devops/interview-questions/observability-distributed.md): 22개 질문, Senior - [Disaster Recovery & Backup](https://sharpskill.dev/ko/technologies/devops/interview-questions/disaster-recovery.md): 20개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/devops/interview-questions/performance-optimization.md): 22개 질문, Senior - [클라우드 비용 최적화](https://sharpskill.dev/ko/technologies/devops/interview-questions/infrastructure-cost.md): 20개 질문, Senior - [SRE 원칙](https://sharpskill.dev/ko/technologies/devops/interview-questions/sre-principles.md): 24개 질문, Senior - [Chaos Engineering](https://sharpskill.dev/ko/technologies/devops/interview-questions/chaos-engineering.md): 20개 질문, Senior - [Platform Engineering](https://sharpskill.dev/ko/technologies/devops/interview-questions/platform-engineering.md): 22개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/devops/interview-questions/shell-scripting-bash