I’m trying to write a small script in bash and it’s not working. I want to count from 0 to 65535 and put that number, 1 per line in a flat file I was trying something like this COUNT=0 while [$COUNT -lt 65536] do echo $COUNT >> /home/netflow/etc/0-65535.txt COUNT=`expr $COUNT + 1` done I keep getting a bash “0 invalid command” Anyone know how to write this expression correctly so it populates the file? Thanks Scott
for IDX in {0..65535}; do [...] done On 06/25/14 12:53, Scott Granados wrote:
I’m trying to write a small script in bash and it’s not working.
I want to count from 0 to 65535 and put that number, 1 per line in a flat file
I was trying something like this COUNT=0 while [$COUNT -lt 65536] do echo $COUNT >> /home/netflow/etc/0-65535.txt COUNT=`expr $COUNT + 1` done
I keep getting a bash “0 invalid command” Anyone know how to write this expression correctly so it populates the file?
Thanks Scott
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
-- --- John G. Heim, 608-263-4189, jheim@math.wisc.edu
ah this works, I adjusted as follows for IDX in {0..65535}; do echo $IDX >> /home/netflow/etc/0-65535.txt done Thanks for the help was in a bind there. Been a while since I shell scripted.:) On Jun 25, 2014, at 2:02 PM, John G. Heim <jheim@math.wisc.edu> wrote:
for IDX in {0..65535}; do [...] done
On 06/25/14 12:53, Scott Granados wrote:
I’m trying to write a small script in bash and it’s not working.
I want to count from 0 to 65535 and put that number, 1 per line in a flat file
I was trying something like this COUNT=0 while [$COUNT -lt 65536] do echo $COUNT >> /home/netflow/etc/0-65535.txt COUNT=`expr $COUNT + 1` done
I keep getting a bash “0 invalid command” Anyone know how to write this expression correctly so it populates the file?
Thanks Scott
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
-- --- John G. Heim, 608-263-4189, jheim@math.wisc.edu
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
Can you use perl instead? perl -E "say $_ for 0..65535" > > /home/netflow/etc/0-65535.txt On Wed, June 25, 2014 12:53 pm, Scott Granados wrote:
Im trying to write a small script in bash and its not working.
I want to count from 0 to 65535 and put that number, 1 per line in a flat file
I was trying something like this COUNT=0 while [$COUNT -lt 65536] do echo $COUNT >> /home/netflow/etc/0-65535.txt COUNT=`expr $COUNT + 1` done
I keep getting a bash 0 invalid command Anyone know how to write this expression correctly so it populates the file?
Thanks Scott
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
Ah Perl, I didn’t think of that. Good pointer. On Jun 25, 2014, at 2:03 PM, Chris Nestrud <ccn@chrisnestrud.com> wrote:
Can you use perl instead?
perl -E "say $_ for 0..65535" > > /home/netflow/etc/0-65535.txt
On Wed, June 25, 2014 12:53 pm, Scott Granados wrote:
I’m trying to write a small script in bash and it’s not working.
I want to count from 0 to 65535 and put that number, 1 per line in a flat file
I was trying something like this COUNT=0 while [$COUNT -lt 65536] do echo $COUNT >> /home/netflow/etc/0-65535.txt COUNT=`expr $COUNT + 1` done
I keep getting a bash “0 invalid command” Anyone know how to write this expression correctly so it populates the file?
Thanks Scott
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
_______________________________________________ Blind-sysadmins mailing list Blind-sysadmins@lists.hodgsonfamily.org http://lists.hodgsonfamily.org/listinfo/blind-sysadmins
participants (3)
-
Chris Nestrud
-
John G. Heim
-
Scott Granados