set --

 

The -- is the standard "don't treat anything following this as an option"   不把后面的string 看成选项(直接看成参数)

[root@hy ~]# cat set2.sh
#!/bin/bash

var="1 2 3"
echo $var

set -- $var #do not treat - as option ,only take $var as $1 $2 ..
i=1
while [ "$i" -le $# ]
do
echo -n "\$$i = " #do not change line
eval echo \$$i
(( i ++ )) # same as let i=i+1
done

set --
echo "\$1 = $1"
echo "\$2 = $2"
echo "\$3 = $3"

[root@hy ~]#

 

https://unix.stackexchange.com/questions/308260/what-does-set-do-in-this-dockerfile-entrypoint

posted on 2018-10-23 18:30  uxiuxi  阅读(251)  评论(0)    收藏  举报