Jump to content

Program name: Difference between revisions

(Added Pascal)
Line 280:
=={{header|D}}==
Will print name of executable.
<lang d>import#!/usr/bin/env std.stdio;rdmd
 
import std.stdio;
 
void main(string[] args) {
string program = writeln(args[0]);
writeln("Program: ", program);
}</lang>
 
The D programming language offers an interpreted mode, which exhibits slightly a different behavior than the compiler.
<lang sh>$ ./scriptname.d
Program: /tmp/.rdmd/Users/andrew/Desktop/src/scriptname/scriptname.d.D3B32385A31B968A3CF8CAF1E1426E5F
$ dmd scriptname.d
$ ./scriptname
Program: ./scriptname</lang>
 
=={{header|Emacs Lisp}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.