Difference between revisions of "$1"

From wikieduonline
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
 
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
  [[if]] [ -n "$1" ]; then
+
  [[if]] [ [[-n]] "$1" ]; then
 
   echo "You supplied the first parameter!"
 
   echo "You supplied the first parameter!"
 
  else
 
  else
 
   echo "First parameter not supplied."
 
   echo "First parameter not supplied."
 
  fi
 
  fi
 +
 +
 +
[[if]] [ [[-z]] "$1" ]; then
 +
  echo "First parameter not supplied."
 +
  echo "Usage: XXXXX"
 +
  [[exit 0]]
 +
fi
 +
 +
== Related ==
 +
* <code>[[echo $0]]</code>
 +
* <code>[[ARG]]</code> in <code>[[Dockerfile]]</code>
 +
* <code>[[$@]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 15:05, 27 September 2024

Advertising: