Portál AbcLinuxu, 10. května 2025 09:34
#!/bin/sh arr[0]=Hello arr[1]=World echo ${arr[*]}vyhodi hlasku:
./test: ./test: 3: arr[0]=Hello: not found ./test: ./test: 4: arr[1]=World: not found ./test: ./test: 5: Syntax error: Bad substitution
Řešení dotazu:
BASH neni shell
Tak to ne. Bash je shell. Stejně jako je shell Bourne shell, ksh, zsh, csh, tcsh a řada dalších.
${!var}
, což ale sh IIRC taky neumí, nebo pomocí eval
(to snad ano).
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.