Simple Script?

B

Bretenn

Guest
do u guys know how to write a script that produce an endless loop of a word (a simple script) in unix?

Sory, i'm a newbee to unix
 
not sure how you mean... do you mean you want to run a command over and over?
 
sory... i want to write a script that can run an endless loop (continuous loop) on the screen. (UNIX)

e.g. Edless loop of a word "speak".
[screen]
speak
speak
speak
speak
speak
...
 
you can try the "echo" command
either put this in a file:
Code:
echo speak
echo speak
echo speak
echo speak
echo speak
echo speak
but thats obviously limited to however many times you write out the line, you could make the file write the word then run itself again, giving an indefinate endless loop:
(for file name "echoscript")
Code:
echo speak
echoscript
im not sure if theres some sort of loop or goto command, hope this has helped tho...
 
well, the echo command does literly that, it echo's onto the screen like so....
[rand0m@gunslinger rand0m]$ echo hello
hello
[rand0m@gunslinger rand0m]$
So if you where to put that command into a file like this
Code:
echo hello
echo hello
echo hello
echo hello
echo hello
echo hello
echo hello
then it will echo it that many times....
[rand0m@gunslinger dave]$ chmod 0777 test
[rand0m@gunslinger dave]$ ./test
hello
hello
hello
hello
hello
hello
hello
[rand0m@gunslinger dave]$
 
man i just did the code for a loop in c++ today but i forgot it.

Code:
for (int x)
{
MessageBeep(0xFFFF);
MessageBeep(0xFFFF);
MessageBeep(0xFFFF);
MessageBeep(0xFFFF);
MessageBeep(0xFFFF);
}

Is this correct?
 
I'd use
Code:
while (true)
{
MessageBeep(0xFFFF);
}
instead
 
yes speak

will repeat the word speak on screen over and over forever.
 
first of all, you have several shells in unix/linux its not like dos where there is only one way to do it. personally i'd use perl

cut & paste whats between the 2 dotted lines (dont actually include them in gthe prog)
---------------------------------------------------------
#!/usr/bin/perl

while(true)
{
print "place text here\n";
}
---------------------------------------------------------
make sure #!/usr/bin/perl is on the 1st line else it'll fu.ck up

then save the file, on the command line type chmod 755 (or 777) filename.
to execute it be in the directory and type ./filename

there ya go!
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back