• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Simple Script?

B

Bretenn

Guest
#1
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
 
B

Bretenn

Guest
#3
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
...
 

SPeedY_B

I may actually be insane.
#4
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...
 

SPeedY_B

I may actually be insane.
#6
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]$
 

DrMetallica

OSNN Senior Addict
#7
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?
 
M

MadHaXX()|2

Guest
#10
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 posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,012
Latest member
Sierge