I've just noticed that the same code for for loop in bash doesn't work in FreeBSD

wolf@linux:~$ echo $SHELL

wolf@linux:~$ for i in {1..3}; do echo $i; done

Is there any alternative for this?

[2.5.0-RELEASE][admin@pfSense]/root: echo $SHELL

[2.5.0-RELEASE][admin@pfSense]/root: for i in {1..3}; do echo $i; done
for: Command not found.
i: Undefined variable.
  • 5
    I think you're in a tcsh shell. Run sh to get a more familiar shell (probably not bash, and may not understand brace expansions, but would be able to do for loops). You could try starting bash 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.
    – Kusalananda
    Mar 7, 2021 at 12:20
  • Yeah, 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} #
    – Wolf
    Mar 7, 2021 at 12:45
  • 3
    Writing 1 2 3 instead of {1..3} requires one less key-press.
    – Kusalananda
    Mar 7, 2021 at 12:52

1 Answer 1


If you want to work with the configuration it is probably better to get used to and learn pfsense PHP Shell

As @Kusalananda writes: It looks like you are in tcsh. If you want to use bash you need to install it first:

pkg install bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.