set --
The --
is the standard "don‘t treat anything following this as an option" 不把后面的string 看成选项(直接看成参数)
[[email protected] ~]# 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"
[[email protected] ~]#
https://unix.stackexchange.com/questions/308260/what-does-set-do-in-this-dockerfile-entrypoint
原文地址:https://www.cnblogs.com/uxiuxi/p/9838395.html
时间: 2024-10-10 16:48:20