tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Find command, exclude dot directories.

MANY FILES in ONE directory ▻

Random number

In article <929105783.164366@news-backup>, Tarus <tanzer@erste.at> wrote:
>How can I get a random number in a variable in C-Shellscript ?

    set x = 17

(17 is a random number, right? :-)

More seriously, you could try this for a die roll.

     set die = `perl -le 'print 1 + int rand(6)'`

[ Standard advice about not writing csh scripts not omitted here. ]

Tim.
--
Tim Goodwin   | `I can't believe that someone is releasing
University of | something called "Unix" without something
Leicester, UK | called "/bin/sh".' -- Randal L. Schwartz

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Random number
Date: 11 Jun 1999 16:31:06 +0100
Organization: University of Leicester, UK
Message-ID: <7jra3q$o4g$1@ltpcg.star.le.ac.uk>
References: <929105783.164366@news-backup>

△ comp.unix.shell △

◅ Find command, exclude dot directories.

MANY FILES in ONE directory ▻