121
\$\begingroup\$

Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

  • Each submission must be a full program.
  • You must create the shortest infinite loop.
  • Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.
  • The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.
  • The program must not write anything to STDERR.
  • Feel free to use a language (or language version) even if it's newer than this challenge. -Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D
  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
  • This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.
  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainf**k-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.
  • There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.
  • Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)


Please feel free to post in the comments to tell me how this challenge could be improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

# Language name, X bytes

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

#[Language name](http://link.to/the/language), X bytes

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"//api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<a>'+lang+'</a>').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang,user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw.toLowerCase()>b.lang_raw.toLowerCase())return 1;if(a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase())return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>

\$\endgroup\$
  • 41
    \$\begingroup\$ I've got to start posting programs with a negative byte count to beat all these empty files! \$\endgroup\$ – CJ Dennis Oct 3 '15 at 4:32
  • 3
    \$\begingroup\$ This challenge is interesting because it brings out lots of 0 byte languages (some of which are NOT esolangs). FWIW, most declarative languages have an implicit infinite loop because declarative languages don't have loops in their syntax (they assume they're running in an infinite loop). Ladder diagrams are perhaps among the oldest such languages. Then you have the Instruction Language (IL), a sort of assembly for PLCs that also assume an infinite loop. ILs, like assembly are different between manufacturers \$\endgroup\$ – slebetman Oct 5 '15 at 9:36
  • \$\begingroup\$ Are programs that read and execute their own source code allowed, or does file I/O break the "must take no input" rule? \$\endgroup\$ – ThisSuitIsBlackNot Oct 6 '15 at 13:05
  • 1
    \$\begingroup\$ @ThisSuitIsBlackNot Yes, file input is allowed. \$\endgroup\$ – Kritixi Lithos Oct 6 '15 at 16:47
  • \$\begingroup\$ Can you print "", an empty string? \$\endgroup\$ – OldBunny2800 Mar 7 '16 at 23:39

477 Answers 477

3
\$\begingroup\$

ZX Spectrum BASIC, 2 bytes

1 RUN

The program will never run out of memory :-)

Explanation:

  • There is no space between the line number and the command, it is just a visual clue displayed when LISTing the program
  • The keyword RUN is one byte, in Sinclair BASIC the keywords were really just a single characters (with codepoints >=128), that just happened to look like multi-character words when displayed. In particular, you enter the keyword by pressing one key, the one with the keyword on it, and it enters one byte.

The internal representation is a bit longer (line number is stored as two bytes), but isn't this true for almost all the languages? :-)

\$\endgroup\$
  • 1
    \$\begingroup\$ The internal representation also has one byte for the end of line character and one byte for the end of program character, so 5 bytes. \$\endgroup\$ – Neil Oct 3 '15 at 20:48
3
\$\begingroup\$

Go, 31 Bytes

package main
func main(){for{}}

Nothing special, the for loop without header runs infinitely.

\$\endgroup\$
3
\$\begingroup\$

Javascript (8 bytes)

for(;;);

Edit courtody of @KritixiLithos

Javascript (10 bytes)

while(1){}
\$\endgroup\$
  • 1
    \$\begingroup\$ Try for(;;); It has 8 bytes. \$\endgroup\$ – Kritixi Lithos Oct 3 '15 at 9:29
  • \$\begingroup\$ @KritixiLithos I forgot that javascript for loops are basically infinite if used wrong. I'm way too used to languages like python which eventually stop for loops. Very clever :) \$\endgroup\$ – Daffy Oct 4 '15 at 10:26
  • \$\begingroup\$ Although, one can make an infinite for loop in python. \$\endgroup\$ – pppery May 12 '17 at 23:11
3
\$\begingroup\$

Lazy K, 8 7 bytes

SISSSII

Reduces to the lambda expression (λx.x x) (λx.x x) which has no normal form.

\$\endgroup\$
  • \$\begingroup\$ Tried to golf it: SISSSII (not tested). \$\endgroup\$ – jimmy23013 Oct 4 '15 at 14:41
  • \$\begingroup\$ That works! Really cool :) \$\endgroup\$ – Lynn Oct 4 '15 at 14:51
3
\$\begingroup\$

SQL (SQL Server 2008+), 92 bytes

WITH R AS(SELECT 1N UNION ALL SELECT N*1FROM R)SELECT*FROM R WHERE N<1OPTION(MAXRECURSION 0)

I feel a little dirty putting this up, but my original thought was that this wouldn't be possible with a SQL query. With something like T-SQL or PL/SQL not a problem, as a query though? The obvious answer was a recursive query with no recursion limit set. But how to get it to run without outputting anything. My initial tests using queries like

WITH R AS(SELECT 1N UNION ALL SELECT N FROM R)SELECT*FROM R WHERE N=0OPTION(MAXRECURSION 0);
WITH R AS(SELECT 1N UNION ALL SELECT N FROM R)SELECT*FROM R WHERE N<1OPTION(MAXRECURSION 0);

showed that the optimizer would cause the query to exit immediately with no rows returned. Using N+1 allowed it to loop, but I suspect that the integer would eventually overflow. I used N*1 in the query to avoid that and trick the optimizer into letting it run without short cutting out. I've let it run for a few minutes on my machine and it didn't seem to start consuming memory, but I can't guarantee that wouldn't happen.

\$\endgroup\$
  • \$\begingroup\$ SQL has loop constructs too, even if it's slow to use them. Why not something like: WHILE 1=1CONTINUE ? \$\endgroup\$ – Bridge Oct 8 '15 at 10:09
  • \$\begingroup\$ @Bridge SQL doesn't really have while loops. The database systems have procedural languages that have loop constructs. With this answer I was trying to keep to SQL rather than T-SQL or PL/SQL. \$\endgroup\$ – MickyT Oct 8 '15 at 17:53
  • \$\begingroup\$ Hey only trying to help, I don't have enough rep here to post my own answer. Doesn't your answer contain things that aren't ANSI SQL either, e.g. SQL Server specific extensions? The truth of the matter is, dump the code I wrote into SQL Server, and you have an infinite loop in a quarter of the code :) \$\endgroup\$ – Bridge Oct 9 '15 at 7:32
  • \$\begingroup\$ @Bridge I understand and thanks for the help. You should be able to post an answer. I think most RDMS's now support recursive CTEs and they were introduced in SQL:1999. So while the syntax may differ slightly I could do this query in postgresql with no issues. \$\endgroup\$ – MickyT Oct 9 '15 at 8:11
  • \$\begingroup\$ It was the OPTION(MAXRECURSION 0) bit I was unsure about :) \$\endgroup\$ – Bridge Oct 9 '15 at 8:29
3
\$\begingroup\$

Rail, 11 bytes

$'main'
@-@

Rail starts at the $ of the main function, heading southeast. We hit -, which makes the train turn and move eastward. After that it's just bouncing all night long between two @ reflectors.

\$\endgroup\$
3
\$\begingroup\$

Insomnia, 2 bytes

HY

It encodes the sequence of instructions: 7289

Although it's not clear whether instruction 8 checks the content of the bit pointer or the group pointer, the code above works in either cases, since the content of the bit or the content of the group is always non-zero.

\$\endgroup\$
3
\$\begingroup\$

NASM/YASM x86 assembly, 4 bytes

ja $

$ is the address of the current instruction, and ja jumps there if the carry and zero flags are both unset. (i.e. the Above condition is true.) This is the case in x86-64 Linux at process startup.

ja$ just defines a symbol, instead of being an instruction, so the space is not optional. I did test that this works without a trailing newline, so it really is 4 bytes.

Assemble/link with

$ yasm -felf64 foo.asm && ld -o foo foo.o
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400080

The x86-64 ABI used by Linux doesn't guarantee anything about the state of registers at process startup, but Linux's actual implementation zeroes all the registers other than RSP for a newly-execed process. EFLAGS=0x202 [ IF ], so ja (jump if Above) does jump, because the carry and zero flags aren't set. jg (ZF=0 and SF=0) would also work. Other OSes that initialize flags differently might be able to use one of the other one-letter conditions that require a flag bit to be set: jz, jl, jc, jp, js.

Using ja instead of jmp (unconditional jump) makes the source one byte shorter, but the binary is the same size (2 bytes: one opcode byte, one rel8 displacement, for a total size of 344 bytes for a stripped ELF64 binary. See casey's answer for a 45 byte ELF executable if you're interested in small binary size rather than small source size.)

\$\endgroup\$
3
\$\begingroup\$

AT&T (PDP-11) Syntax Assembly: 4 bytes

br .

PDP-11 UNIX A.OUT binary output: 24 18 bytes

0000000  000407 000002 000000 000000 000000 000000 000000 000000
0000020  000777 000000 000000 000004
0000030

This is the output produced by the assembler. As the sizes in the header show, the last three words are not necessary, it can be cut down to the first 18 bytes.

Some modern assemblers do not support the br instruction, so it would be five bytes for jmp .. And executable headers are generally much bigger these days.

Linux x86-64 binary output, after strip: 336 bytes

Now, OSX's assembler is much more strict. You must have a symbol (by default start, but here I use f) for the entry point, which balloons the size of the source. It also requires a newline at the end of the file.

Mac OS X x86-64 Assembly: 17 bytes

.globl f
f:jmp f

Mac OS Mach-O Binary Output: 4200 bytes

\$\endgroup\$
  • 2
    \$\begingroup\$ You can get smaller binary output if you golf the ELF header in Linux: see codegolf.stackexchange.com/a/59479/19694 \$\endgroup\$ – casey Oct 3 '15 at 3:35
  • \$\begingroup\$ What machine is br . for? x86? Which assembler? GNU as rejects it for x86-64. In any case, I posted a 4-byte x86 YASM source, which assembles and links into a complete working infinite loop program on Linux: ja $. GNU ld defaults to 0x0400080 if it can't find a _start symbol, so this really is a complete program. \$\endgroup\$ – Peter Cordes Oct 6 '15 at 21:07
  • \$\begingroup\$ @PeterCordes PDP-11 - and I assume also VAX, though I haven't had a chance to test it. It's common for older assemblers to use separate mnemonics for short jump instructions. The PDP-11 instruction contains the offset within the instruction word, with a range of even values from -64 to +62. \$\endgroup\$ – Random832 Oct 6 '15 at 21:08
  • \$\begingroup\$ @Random832: could you update your answer, then? "AT&T syntax" doesn't specify a machine. For example, there is an i386/amd64 flavour of "AT&T syntax", used by the GNU tools by default. add $16, %rsp, for example. \$\endgroup\$ – Peter Cordes Oct 6 '15 at 21:10
  • \$\begingroup\$ My answer goes into detail on the source required to make a usable x86-64 program on GNU/Linux and Mac OSX. By "AT&T" I meant the actual original assembler produced by AT&T, whose syntax is imitated by these other assemblers. \$\endgroup\$ – Random832 Oct 6 '15 at 21:11
3
\$\begingroup\$

Ziim, 14 bytes

Encoded in UTF-16. (UTF-8 without BOM is 16 bytes...)

↘↙↙
↑↑
\$\endgroup\$
3
\$\begingroup\$

Emmental, 18 11 bytes

;#35#63#!#?

Emmental is a self-modifying, stack-based language. It has no built-in looping operator, so we have to make our own. Here's what the relevant commands mean (taken from the Esolangs wiki page):

  • ; - Push the symbol ; onto the stack.
  • # - Push NUL (ASCII 0) onto the stack.
  • 0..9 - Pop a symbol, multiply its value by 10, add 0..9 respectively, and push the result.
  • ! - Pop a symbol and an Emmental program (a string of symbols terminated by ;). Then redefine that symbol as having the same semantics as that Emmental program.
  • ? Pop a symbol and execute it. This is similar to eval.

So, what does this program (created by @Sp3000) actually do? Well, it redefines NUL to mean #? (push NUL and execute it), then executes NUL. This sets off a domino-like effect where NUL executes NUL executes NUL executes NUL...you get the picture.

I'm no expert on Emmental, but there may be an even shorter way to loop infinitely. Suggestions welcome!

\$\endgroup\$
  • \$\begingroup\$ Since you put in the effort to write an explanation, here you go: ;#35#63#!#? \$\endgroup\$ – Sp3000 Oct 7 '15 at 15:33
  • \$\begingroup\$ @Sp3000 Thanks, that's a clever way to do it! I've updated the answer. \$\endgroup\$ – ETHproductions Oct 7 '15 at 16:00
3
\$\begingroup\$

ArnoldC, 61 bytes

IT'S SHOWTIME
STICK AROUND 1
CHILL
YOU HAVE BEEN TERMINATED

Ironic how the program never actually terminates, even though the last line says "YOU HAVE BEEN TERMINATED."

\$\endgroup\$
3
\$\begingroup\$

x86 Assembly, 3 Bytes

Inspired by this post

E8 FD FF

is the same as

label: call label

even better, write it to your boot sector to make your computer unbootable faster!

\$\endgroup\$
  • \$\begingroup\$ This is actually more nefarious than it seems at first since it's actually self-modifying code. Yes, it will eventually create a stack overflow situation and (in at least an unprivileged OS like DOS) replace the entire contents of memory with the return address of the CALL (label + 3 bytes). If say that value is 103H then technically you've just filled the entirety of memory with the instruction ADD AX,[BX+DI] (or ADD [BX+DI],AX) which will then in fact execute infinitely. Cute. \$\endgroup\$ – 640KB Aug 21 at 20:11
3
\$\begingroup\$

Minkolang, 1 byte

A language inspired by space-time has to have at least SOME space! It's also worth noting that this particular 2D infinite loop is unique in that it's actually looping through time. That is, it's falling through the layers (of which there is only 1) of the program, which is toroidal.

\$\endgroup\$
3
\$\begingroup\$

Underload, 6 bytes

Directly from the esolangs page.

(:^):^
(:^)     Pushes :^ to the stack.
    :    Duplicates the top of the stack
     ^   Pops the top of the stack and includes it in the command

Try it here using the stepping option to see it working

\$\endgroup\$
  • \$\begingroup\$ Do you mean "top" instead "tope"? \$\endgroup\$ – Kritixi Lithos Nov 5 '15 at 20:28
3
\$\begingroup\$

PoGo, 4 bytes

pogo

Explanation:

  • po - add current position in code to the top of the po stack
  • go - pop the most recent po location off the stack and jump there

PoGo uses an explicit call stack for flow control, the "po" stack. This code unconditionally jumps back to the beginning, producing an infinite loop. Note that it will not cause a stack overflow, the call stack will never contain more than one element.

\$\endgroup\$
3
\$\begingroup\$

Aubergine, 6 bytes

:aa=ia

:aa is a no-op. =ia sets the IP to its own location.

\$\endgroup\$
  • \$\begingroup\$ Likewise, aaaiii is the shortest for Purple BUT -i3 is the shortest for UberGenes \$\endgroup\$ – quintopia Dec 31 '15 at 6:53
3
\$\begingroup\$

Quipu, 5 bytes

0&
??

0& pushes 0 as the current strand's value and ?? is an unconditional jump to that strand (which is the strand we're already on).

\$\endgroup\$
3
\$\begingroup\$

Mumps, 1 byte

F

Mumps being a very old language, most of it's commands and operators can be truncated to 1 or 2 letters. The [F]or command with no parameters defaults to an infinite loop until interrupted by a {CTRL}{C}. The flavour of Mumps that I use is InterSystem Caché.

\$\endgroup\$
3
\$\begingroup\$

Fuzzy Octo Guacamole, 2 bytes

()

A empty infinite loop.

\$\endgroup\$
  • \$\begingroup\$ Can you include a link to the language in the header? \$\endgroup\$ – Downgoat Apr 15 '16 at 1:11
  • \$\begingroup\$ @Downgoat done. \$\endgroup\$ – Rɪᴋᴇʀ Apr 15 '16 at 1:14
3
\$\begingroup\$

V, 1 byte

ò

V is a 2D string based golfing language that I wrote am in the process of writing, inspired by vim. In vim, recursive macros are a little bit of a pain to set up, so I tried to make them as easy as possible in V. The syntax for a recursive macro is:

ò<code>ò

This is equivalent to

qq<code>@qq@q

in vim.

V will automagically fill in the missing delimiter (in this case, the second ò) so we can leave it off, giving us a nice and simple one-byte solution.

\$\endgroup\$
3
\$\begingroup\$

evil, 2 bytes

mb

Nothing to see here, just another self-GOTO...

\$\endgroup\$
3
\$\begingroup\$

MATL, 3 2 bytes

Quite simple really:

`T

`    # Do ... while
 T   # True
     # Implicit end, normally: ]

Try it online here (Please stop it after testing, don't keep it running).

\$\endgroup\$
3
\$\begingroup\$

GPRX 3000, 1 byte

g

Sets the IP to the value of register A (which is initially 0).

\$\endgroup\$
3
\$\begingroup\$

Seed, 3 bytes

0 0

Equivalent to an empty Befunge program.

\$\endgroup\$
3
\$\begingroup\$

Noobinary, 4 bytes

0000

0000 is a single instruction that jumps to the last 00 (or start of program) if the top of stack is 0.

\$\endgroup\$
3
\$\begingroup\$

Barely, 0 bytes


That's right! If the Barely interpreter receives the empty program, then it just hangs. Normally, the code would be terminated with a ~ to separate it from input, so the interpreter keeps reading EOF and never runs anything. Tested on DOSBox v0.74 using input redirection.

\$\endgroup\$
3
\$\begingroup\$

Subskin, 6 bytes








A series of six newlines. It contains two instructions, both of which set the IP to the second instruction.

\$\endgroup\$
3
\$\begingroup\$

BASIC, 8 bytes

1 GOTO 1

Goto self

\$\endgroup\$
3
\$\begingroup\$

Linux shebang, 5 bytes

#!./a

Must be named as a.

Will run out of memory, but this is an infinite loop.

\$\endgroup\$
  • 1
    \$\begingroup\$ I can't believe nobody's thought of this! +1 \$\endgroup\$ – Rɪᴋᴇʀ Jun 8 '16 at 9:02
  • \$\begingroup\$ Which system? On Ubuntu exec is a Bash built-in, so I can't specify it as script interpreter. \$\endgroup\$ – manatwork Jun 8 '16 at 9:09
  • \$\begingroup\$ @manatwork oh, sorry, i forgot that it is built-in. fixed \$\endgroup\$ – username.ak Jun 8 '16 at 9:11
  • 1
    \$\begingroup\$ Not runs out of memory: “bash: ./a: ./: bad interpreter: Too many levels of symbolic links”. (Though no actual symlink involved.) Well, infinite for 0.001 second. \$\endgroup\$ – manatwork Jun 8 '16 at 12:55
  • 1
    \$\begingroup\$ Not working ...bad interpreter... better put ./a alone in the script. If you want to avoid out of memory use ./a& . That's fun if you ps after. That last script will put your computer in a race of creating processes and managing dead processes \$\endgroup\$ – Emmanuel Sep 27 '16 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.