Bash: how to test whether a variable is set?

Project:Linux software
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Related pages:#5382: Bash: validating variables and parameters
Tags:bash script
Description

Bash: how to test whether a variable is set?

For example, in a bash script, ${1} stands for the first argument the script was called with. However, ${1} might not be set.
How to test this?

Comments

#1

Status:active» fixed
Related pages:-303: Bash+5382: Bash: validating variables and parameters

#2

Status:fixed» closed
Related pages:-5382: Bash: validating variables and parameters

Automatically closed -- issue fixed for 2 weeks with no activity.