
Shell Scripting & Bash
Variables, loops, conditionals, functions, pipes, redirections
1What is the correct syntax to declare a variable in Bash?
What is the correct syntax to declare a variable in Bash?
Antwoord
In Bash, a variable is declared without the dollar sign and without spaces around the equals sign. The variable name must start with a letter or underscore. To use the variable's value, prefix its name with the dollar sign ($). Spaces around the equals sign cause a syntax error because Bash interprets them as separate command arguments.
2How to access the value of a variable named USERNAME in Bash?
How to access the value of a variable named USERNAME in Bash?
Antwoord
To access a variable's value, prefix its name with the dollar sign ($). The syntax $USERNAME retrieves the value stored in the variable. The syntax ${USERNAME} can also be used, which offers more flexibility, especially for concatenation or using modifiers. Without the dollar sign, Bash interprets USERNAME as a literal string and not as a variable reference.
3Which command allows exporting a variable to make it accessible to child processes?
Which command allows exporting a variable to make it accessible to child processes?
Antwoord
The export command makes an environment variable available to all child processes launched from the current shell. Without export, a variable is local to the current shell and is not passed to subprocesses. This distinction is crucial when writing scripts that invoke other scripts or programs. It is possible to combine declaration and export in one line with export VAR=value.
How to capture the exit code of the last executed command?
What is the correct syntax for an if condition in Bash?
+17 gespreksvragen
Andere DevOps-sollicitatieonderwerpen
Version Control & Git
Linux Fundamentals
Networking Basics
Docker Fundamentals
CI/CD Fundamentals
GitHub Actions
GitLab CI/CD
Jenkins
Kubernetes Basics
Kubernetes Networking
Kubernetes Advanced
Ingress & API Gateway
Terraform Basics
Terraform Advanced
Ansible & Configuration Management
AWS Essentials
Azure Fundamentals
GCP Fundamentals
Monitoring & Prometheus
Logging & ELK Stack
Alerting & Incident Response
Cloud Identity & Secrets
CI/CD Pipeline Security
Helm & Kubernetes
Runtime & Cluster Security
Container Supply Chain Security
Service Mesh & Istio
GitOps & ArgoCD
Progressive Delivery
Distributed Observability
Disaster Recovery & Backup
Performance Optimization
Cloud Cost Optimization
SRE Principles
Chaos Engineering
Platform Engineering
Beheers DevOps voor je volgende gesprek
Krijg toegang tot alle vragen, flashcards, technische tests, code review-oefeningen en gespreksimulatoren.
Begin gratis