I've just noticed that the same code for for loop
in bash doesn't work in FreeBSD
wolf@linux:~$ echo $SHELL
/bin/bash
wolf@linux:~$
wolf@linux:~$ for i in {1..3}; do echo $i; done
1
2
3
wolf@linux:~$
Is there any alternative for this?
[2.5.0-RELEASE][admin@pfSense]/root: echo $SHELL
/etc/rc.initial
[2.5.0-RELEASE][admin@pfSense]/root:
[2.5.0-RELEASE][admin@pfSense]/root: for i in {1..3}; do echo $i; done
for: Command not found.
i: Undefined variable.
[2.5.0-RELEASE][admin@pfSense]/root:
tcsh
shell. Runsh
to get a more familiar shell (probably notbash
, and may not understand brace expansions, but would be able to dofor
loops). You could try startingbash
too, but I have no clue if it's included in the pfsense distribution. This is not a real answer as I have no way of testing it.sh
is working, but it can't expand the brace expansions and print it out literally# for i in {1,3}; do echo $i; done {1,3} #
1 2 3
instead of{1..3}
requires one less key-press.