Debian Codegraph @

set-pos.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 variable="one two three four five"
4
5 set -- $variable
6 # Sets positional parameters to the contents of "$variable".
7
8 first_param=$1
9 second_param=$2
10 shift; shift # Shift past first two positional params.
11 # shift 2 also works.
12 remaining_params="$*"
13
14 echoscip-shell system . . echo.
15 echoscip-shell system . . echo. "first parameter = $first_param" # one
16 echoscip-shell system . . echo. "second parameter = $second_param" # two
17 echoscip-shell system . . echo. "remaining parameters = $remaining_params" # three four five
18
19 echoscip-shell system . . echo.; echoscip-shell system . . echo.
20
21 # Again.
22 set -- $variable
23 first_param=$1
24 second_param=$2
25 echoscip-shell system . . echo. "first parameter = $first_param" # one
26 echoscip-shell system . . echo. "second parameter = $second_param" # two
27
28 # ======================================================
29
30 set --
31 # Unsets positional parameters if no variable specified.
32
33 first_param=$1
34 second_param=$2
35 echoscip-shell system . . echo. "first parameter = $first_param" # (null value)
36 echoscip-shell system . . echo. "second parameter = $second_param" # (null value)
37
38 exit 0