I'm trying to write a script that generates a file of varying size filled with random text and am having some difficulties.
The major problems are that I'm limited to csh and a lot of the systems I have to run this on don't have a /dev/random (so a wrapper around the dd if=/dev/random or dd if=/dev/zero commands won't work).
This script is going to be run on varying UNIX operating systems and, as I've said, the lowest common denominator is csh. I'd like to make this as cross-platform as possible.
Sure. I'm going to use it to generate a file to ftp to/from multiple systems for network benchmarking.
I already have all the ftp parts automated, I just can't figure out how to generate the file dynamically before ftp kicks in (I don't actually want to keep the files, they just need to be around for the ftp's).
Being limited to csh and not having /dev/random hurts a bit.
I'm not sure what you mean by 'fishy' but just because *you* don't see a need for it doesn't mean it isn't legitimate. I really don't want to leave 100-300MB files laying around for when my management gets a wild hair to see how our network connections are doing.
In the future, a simple "I don't know" would suffice instead of calling into question my purpose.
You seem to be taking this rather personally. Have you been struggling with this issue for a while? Do you think you might benefit from a break for a chance to look at it from a fresh perspective?
What I would benefit from is people helping me solve this problem instead of calling to question my intent, then wondering why I'm being defensive. If you can't understand that, then I have neither the patienct nor the energy to explain it to you.
Either you wish to help me or you don't. If you wish to help, great! Otherwise, move on.
1)create a junk file having varying lines of lengths of data ....
2)put a while loop for number of files u want ...
if u want 100 files repeat the loop 100 time
get the random number using the following
3)x=`expr $RANDOM % 1000`
4) Using this random number 'x' get the xth line from junk file
put it in the randomfile using date upto seconds
since time changes for evry sec ... u will have 60 diff files in a minute.
Firstly, I don't use csh (I use bourne variants), so your milage may well vary. Also; I don't know whether the lack of /dev/(u)random will effect the ability of awk to generate random numbers?
There are lots of other ideas in a script over at shelldorado although all but one seem to depend on either some kind of device file (random or urandom), or a RANDOM shell builtin.
Some kind of date manipulation may be your only option.