Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Sep 2008 11:25:32 GMT
From:      Anarchist <Anarchist@nixp.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/127063: shell: $RANDOM doesn't works in scripts
Message-ID:  <200809031125.m83BPWiQ097463@www.freebsd.org>
Resent-Message-ID: <200809031130.m83BU1V9080440@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         127063
>Category:       i386
>Synopsis:       shell: $RANDOM doesn't works in scripts
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 03 11:30:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Anarchist
>Release:        FreeBSD 6.3-RELEASE #0
>Organization:
nixp.ru
>Environment:
FreeBSD gw-1.caotus.ru 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Apr 16 10:24:30 MSD 2008     root@gw-1.caotus.ru:/usr/src/sys/i386/compile/GW-1_KERNEL  i386
also seen on
FreeBSD mx4.elpay.ru 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007     root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
# pkg_info | grep bash
bash-3.2.33         The GNU Project's Bourne Again SHell
and
# pkg_info | grep bash
bash-3.2.25         The GNU Project's Bourne Again SHell
>How-To-Repeat:
Executing "expr $RANDOM % 4" in command line does what it is to do generating random numbers from 0 to 3.

When I try to put generating of random numbers in a script like:
#!/usr/local/bin/bash
 
expr $RANDOM % 4
 
exit 0

or
#!/bin/sh
 
expr $RANDOM % 4
 
exit 0

I get the syntax error: "expr: syntax error"


Trying to execute both the command and the script on my Linux workstation gives normal result.
>Fix:
Unknown

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809031125.m83BPWiQ097463>