0

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: 
0

2 Answers 2

1

I had the same issues. Being used to Debian, FreeBSD presented some challenges. Following this post got to this result in my terminal

root@OPNsense:~# foreach VALUE (`seq 2 12`)
foreach? echo $VALUE
foreach? end
2
3
4
5
6
7
8
9
10
11
12
root@OPNsense:~#

Hope this helps.

1

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

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

pkg install bash
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.