IMC!


Contents


Photos

 







Browsing around...
News  News Links  Links Blog  Blog Italiano  Español 
07 - Case structure in the bash

 | 

The case..esac construct allows to execute an operation according to the value assumed by a variable. The structure is:

case $control_variable in
 0) code0
    ;;
 1) code1
    ;;
 2) code2
    ;;
esac

If the variable assumes the value 0, the codice0 is executed; if the variable assumes the value 1, the code1 is executed, etc. Here is an example:

#!/bin/bash
x=5
case $x in
  0) echo "Value of x: 0"
     ;;
  5) echo "Value of x: 5"
     ;;
  9) echo "Value of x: 9"
     ;;
esac


 | 






Fatal error: Call to undefined function sqlite_open() in /membri/giacobbe85/include/commenti.inc.php on line 324