Take notes on the command line: Difference between revisions

m
syntax highlighting fixup automation
(Added XPL0 example.)
m (syntax highlighting fixup automation)
Line 12:
=={{header|11l}}==
 
<langsyntaxhighlight lang="11l">:start:
I :argv.len == 1
print(File(‘notes.txt’).read(), end' ‘’)
Line 18:
V f = File(‘notes.txt’, ‘a’)
f.write(Time().format("YYYY-MM-DD hh:mm:ss\n"))
f.write("\t"(:argv[1..].join(‘ ’))"\n")</langsyntaxhighlight>
 
=={{header|8086 Assembly}}==
Line 24:
This code assembles into a .COM file that runs under MS-DOS.
 
<langsyntaxhighlight lang="asm"> bits 16
cpu 8086
;;; MS-DOS PSP locations
Line 186:
filnam: db 'NOTES.TXT',0 ; File name to use
section .bss
filebuf: resb BUFSZ ; 4K file buffer</langsyntaxhighlight>
 
{{out}}
Line 213:
{{works with|Ada 2005}}
 
<langsyntaxhighlight Adalang="ada">with Ada.Calendar.Formatting;
with Ada.Characters.Latin_1;
with Ada.Command_Line;
Line 263:
Ada.Text_IO.Close (File => Notes_File);
end if;
end Notes;</langsyntaxhighlight>
 
=={{header|Aime}}==
<langsyntaxhighlight lang="aime">#! /usr/local/bin/aime -a
 
if (argc() == 1) {
Line 293:
 
f.byte('\n');
}</langsyntaxhighlight>
 
=={{header|APL}}==
{{works with|GNU APL}}
 
<langsyntaxhighlight APLlang="apl">#!/usr/local/bin/apl -s --
 
∇r←ch Join ls ⍝ Join list of strings with character
Line 334:
 
Notes
)OFF</langsyntaxhighlight>
 
{{out}}
Line 360:
=={{header|AppleScript}}==
Requires a modernish version of OS X (Lion or later) on which osascript works as a shebang interpreter.
<langsyntaxhighlight lang="applescript">#!/usr/bin/osascript
 
-- format a number as a string with leading zero if needed
Line 442:
end try
end if
end run</langsyntaxhighlight>
 
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">notes: "notes.txt"
if? empty? arg [
if exists? notes -> print read notes
Line 454:
"\t" ++ (join.with:" " to [:string] arg) ++ "\n"
write.append notes output
]</langsyntaxhighlight>
 
{{out}}
Line 465:
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight lang="autohotkey">Notes := "Notes.txt"
 
If 0 = 0 ; no arguments
Line 487:
FileAppend, `r`n, %Notes%
 
EOF:</langsyntaxhighlight>
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f TAKE_NOTES.AWK [notes ... ]
# examples:
Line 515:
printf("\n") >>log_name
}
</syntaxhighlight>
</lang>
{{out}} from the three example commands:
<pre>
Line 530:
for this to work with older versions of QB.
 
<langsyntaxhighlight lang="qbasic">IF LEN(COMMAND$) THEN
OPEN "notes.txt" FOR APPEND AS 1
PRINT #1, DATE$, TIME$
Line 545:
CLOSE
END IF
END IF</langsyntaxhighlight>
 
=={{header|Batch File}}==
{{works with|Windows NT|4}}
<langsyntaxhighlight lang="dos">@echo off
if %1@==@ (
if exist notes.txt more notes.txt
Line 555:
)
echo %date% %time%:>>notes.txt
echo %*>>notes.txt</langsyntaxhighlight>
 
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
This must be compiled to an EXE and run from the command prompt.
<langsyntaxhighlight lang="bbcbasic"> REM!Exefile C:\NOTES.EXE, encrypt, console
REM!Embed
LF = 10
Line 588:
CLOSE #notes%
QUIT</langsyntaxhighlight>
 
=={{header|C}}==
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <time.h>
 
Line 621:
if (note) fclose(note);
return 0;
}</langsyntaxhighlight>
 
=={{header|C sharp|C#}}==
<langsyntaxhighlight lang="csharp">using System;
using System.IO;
using System.Text;
Line 656:
}
}
}</langsyntaxhighlight>
 
=={{header|C++}}==
<langsyntaxhighlight lang="cpp">#include <fstream>
#include <iostream>
#include <ctime>
Line 695:
}
}
}</langsyntaxhighlight>
 
=={{header|Clojure}}==
<langsyntaxhighlight lang="clojure">(ns rosettacode.notes
(:use [clojure.string :only [join]]))
 
Line 710:
(println (slurp "NOTES.txt"))))
 
(notes *command-line-args*)</langsyntaxhighlight>
 
{{out}}
Line 730:
 
=={{header|CLU}}==
<langsyntaxhighlight lang="clu">% This program uses the "get_argv" function that is supplied iwth
% PCLU in "useful.lib".
 
Line 797:
else add_note(note)
end
end start_up</langsyntaxhighlight>
{{out}}
<pre>$ ls
Line 819:
=={{header|COBOL}}==
{{works with|OpenCOBOL}}
<langsyntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. NOTES.
 
Line 896:
 
GOBACK
.</langsyntaxhighlight>
 
=={{header|Common Lisp}}==
<langsyntaxhighlight lang="lisp">(defparameter *notes* "NOTES.TXT")
 
(defun format-date-time (stream)
Line 920:
 
(defun main ()
(notes (uiop:command-line-arguments)))</langsyntaxhighlight>
 
=={{header|D}}==
<langsyntaxhighlight lang="d">void main(in string[] args) {
import std.stdio, std.file, std.datetime, std.range;
 
Line 936:
f.writefln("\t%-(%s %)", args.dropOne);
}
}</langsyntaxhighlight>
{{out}}
<pre>C:\>notes Permission to speak, sir!
Line 950:
 
=={{header|Delphi}}==
<langsyntaxhighlight lang="delphi">program notes;
 
{$APPTYPE CONSOLE}
Line 991:
sw.Free;
end;
end.</langsyntaxhighlight>
 
=={{header|E}}==
 
<langsyntaxhighlight lang="e">#!/usr/bin/env rune
 
def f := <file:notes.txt>
Line 1,011:
w.close()
}
}</langsyntaxhighlight>
 
=={{header|Elixir}}==
{{trans|Erlang}}
<langsyntaxhighlight lang="elixir">defmodule Take_notes do
@filename "NOTES.TXT"
Line 1,029:
end
 
Take_notes.main(System.argv)</langsyntaxhighlight>
 
=={{header|Erlang}}==
<syntaxhighlight lang="erlang">
<lang Erlang>
#! /usr/bin/env escript
 
Line 1,057:
Existing_contents = file_contents(),
file:write_file( file(), [Existing_contents, Notes, "\n"] ).
</syntaxhighlight>
</lang>
 
=={{header|Euphoria}}==
<langsyntaxhighlight Euphorialang="euphoria">constant cmd = command_line()
constant filename = "notes.txt"
integer fn
Line 1,091:
puts(fn,line)
close(fn)
end if</langsyntaxhighlight>
 
=={{header|F Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">open System;;
open System.IO;;
 
Line 1,116:
| 0 -> show_notes()
| _ -> take_note <| String.concat " " args;
0;;</langsyntaxhighlight>
 
Usage:
Line 1,133:
 
=={{header|Factor}}==
<langsyntaxhighlight lang="factor">#! /usr/bin/env factor
USING: kernel calendar calendar.format io io.encodings.utf8 io.files
sequences command-line namespaces ;
Line 1,145:
print flush
] with-file-appender
] if-empty</langsyntaxhighlight>
 
=={{header|Fantom}}==
 
<langsyntaxhighlight lang="fantom">
class Notes
{
Line 1,175:
}
}
</syntaxhighlight>
</lang>
 
Sample:
Line 1,195:
The following is SwiftForth-specific, and runs in the Forth environment rather than as a standalone terminal application. Win32Forth only needs simple replacements of DATE and TIME . A Unix Forth would come closer to the 'commandline' requirement, as Windows Forths for whatever reason very eagerly discard the Windows console. Because this runs in the Forth environment, the otherwise acceptable application words are stuffed in a wordlist. Standard Forth doesn't have the notion of create-it-if-it-doesn't-exist, so OPEN just tries again with CREATE-FILE if OPEN-FILE fails.
 
<langsyntaxhighlight lang="forth">vocabulary note-words
get-current also note-words definitions
 
Line 1,238:
open 0 parse dup if add-note
else 2drop dump then close ;
previous</langsyntaxhighlight>
The following is exactly the same program, but written in 4tH. 4tH has an I/O system which is different from ANS-Forth. The notes file is specified on the commandline.
<langsyntaxhighlight lang="forth">\ -- notes.txt
include lib/argopen.4th
include lib/ansfacil.4th
Line 1,268:
refill drop 0 parse dup if add-note else 2drop dump then ;
 
note</langsyntaxhighlight>
 
=={{header|Fortran}}==
<langsyntaxhighlight lang="fortran">
program notes
implicit none
Line 1,301:
endif
end program notes
</syntaxhighlight>
</lang>
{{out}}<pre>
2022-2-20T18:40:13
Line 1,310:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">If Len(Command) Then
Open "notes.txt" For Append As #1
Print #1, Date, Time
Line 1,329:
End If
Close #1
Sleep</langsyntaxhighlight>
 
 
=={{header|Gambas}}==
<langsyntaxhighlight lang="gambas">'Note that the 1st item in 'Args' is the file name as on the command line './CLIOnly.gambas'
 
Public Sub Main()
Line 1,355:
Endif
 
End</langsyntaxhighlight>
Output:
<pre>
Line 1,365:
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
 
import (
Line 1,413:
os.Exit(1)
}
}</langsyntaxhighlight>
 
=={{header|Groovy}}==
<langsyntaxhighlight lang="groovy">def notes = new File('./notes.txt')
if (args) {
notes << "${new Date().format('YYYY-MM-dd HH:mm:ss')}\t${args.join(' ')}\n"
Line 1,422:
println notes.text
}
</syntaxhighlight>
</lang>
 
=={{header|Haskell}}==
<langsyntaxhighlight lang="haskell">import System.Environment (getArgs)
import System.Time (getClockTime)
 
Line 1,436:
else
do ct <- getClockTime
appendFile "notes.txt" $ show ct ++ "\n\t" ++ unwords args ++ "\n"</langsyntaxhighlight>
 
{{out}} after a few runs:
Line 1,447:
 
=={{header|HicEst}}==
<langsyntaxhighlight HicEstlang="hicest">SYSTEM(RUN) ! start this script in RUN-mode
 
CHARACTER notes="Notes.txt", txt*1000
Line 1,466:
ENDIF
 
ALARM(999) ! quit HicEst immediately</langsyntaxhighlight>
<pre>Thu 2010-09-16 18:42:15
This is line 1
Line 1,475:
=={{header|Icon}} and {{header|Unicon}}==
 
<syntaxhighlight lang="icon">
<lang Icon>
procedure write_out_notes (filename)
file := open (filename, "rt") | stop ("no notes file yet")
Line 1,496:
else add_to_notes (notes_file, args)
end
</syntaxhighlight>
</lang>
 
{{out}}
Line 1,516:
=={{header|J}}==
'''Solution''':<br>
<langsyntaxhighlight lang="j">require 'files strings'
 
notes=: monad define
Line 1,528:
 
notes 2}.ARGV
exit 0</langsyntaxhighlight>
 
Create a Shortcut called <tt>Notes</tt> that calls the script above using the Target:<br>
Line 1,551:
 
=={{header|Java}}==
<langsyntaxhighlight lang="java">import java.io.*;
import java.nio.channels.*;
import java.util.Date;
Line 1,571:
}
}
}</langsyntaxhighlight>
 
=={{header|JavaScript}}==
{{works with|JScript}}
<langsyntaxhighlight lang="javascript">var notes = 'NOTES.TXT';
 
var args = WScript.Arguments;
Line 1,600:
f.WriteLine();
f.Close();
}</langsyntaxhighlight>
<pre>> del NOTES.TXT
> cscript /nologo notes.js
Line 1,609:
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">using Dates
 
const filename = "NOTES.TXT"
Line 1,621:
end
close(fp)
</syntaxhighlight>
</lang>
 
=={{header|Kotlin}}==
<langsyntaxhighlight lang="scala">// version 1.2.10
 
import java.io.File
Line 1,643:
f.appendText(notes)
}
}</langsyntaxhighlight>
 
Sample output:
Line 1,655:
 
=={{header|Lasso}}==
<langsyntaxhighlight Lassolang="lasso">#!/usr/bin/lasso9
 
local(
Line 1,676:
else
#notesfile -> exists ? stdout(#notesfile -> readstring)
}</langsyntaxhighlight>
 
Called with:
<langsyntaxhighlight Lassolang="lasso">./notes "Rosetta was here" Räksmörgås
./notes First Second Last
./notes
</syntaxhighlight>
</lang>
<pre>2013-11-15 11:43:08
Rosetta was here, Räksmörgås
Line 1,690:
 
=={{header|Lua}}==
<langsyntaxhighlight lang="lua">filename = "NOTES.TXT"
 
if #arg == 0 then
Line 1,710:
 
fp:close()
end</langsyntaxhighlight>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<syntaxhighlight lang="text">If[Length[$CommandLine < 11], str = OpenRead["NOTES.TXT"];
Print[ReadString[str, EndOfFile]]; Close[str],
str = OpenAppend["NOTES.TXT"]; WriteLine[str, DateString[]];
WriteLine[str, "\t" <> StringRiffle[$CommandLine[[11 ;;]]]];
Close[str]]</langsyntaxhighlight>
 
=={{header|MATLAB}} / {{header|Octave}}==
 
<langsyntaxhighlight Matlablang="matlab"> function notes(varargin)
% NOTES can be used for taking notes
% usage:
Line 1,746:
fprintf(fid,'\n');
fclose(fid);
end; </langsyntaxhighlight>
 
=={{header|Mercury}}==
<langsyntaxhighlight lang="mercury">:- module notes.
:- interface.
 
Line 1,809:
notes_filename = "NOTES.TXT".
 
:- end_module notes.</langsyntaxhighlight>
 
=={{header|Nim}}==
<langsyntaxhighlight lang="nim">import os, times, strutils
 
if paramCount() == 0:
Line 1,821:
f.writeLine getTime()
f.writeLine "\t", commandLineParams().join(" ")
f.close()</langsyntaxhighlight>
Sample format.txt:
<pre>2021-04-21T15:49:00+02:00
Line 1,829:
 
=={{header|OCaml}}==
<langsyntaxhighlight lang="ocaml">#! /usr/bin/env ocaml
#load "unix.cma"
 
Line 1,859:
if Array.length Sys.argv = 1
then dump_notes()
else take_notes()</langsyntaxhighlight>
 
=={{header|Oz}}==
<langsyntaxhighlight lang="oz">functor
import
Application
Line 1,895:
end
{Application.exit 0}
end</langsyntaxhighlight>
 
=={{header|Pascal}}==
Free Pascal in Delphi mode or Delphi in console mode.
 
<syntaxhighlight lang="pascal">
<lang Pascal>
{$mode delphi}
PROGRAM notes;
Line 1,939:
END;
END.
</syntaxhighlight>
</lang>
 
{{out|Program usage and output}}
Line 1,954:
 
=={{header|Perl}}==
<langsyntaxhighlight Perllang="perl">my $file = 'notes.txt';
if ( @ARGV ) {
open NOTES, '>>', $file or die "Can't append to file $file: $!";
Line 1,962:
print <NOTES>;
}
close NOTES;</langsyntaxhighlight>
 
{{out}} after a few runs:
Line 1,973:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(notonline)-->
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (file i/o)</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">cmd</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">command_line</span><span style="color: #0000FF;">(),</span>
Line 1,986:
<span style="color: #7060A8;">close</span><span style="color: #0000FF;">(</span><span style="color: #000000;">fn</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</langsyntaxhighlight>-->
 
=={{header|PHP}}==
<langsyntaxhighlight lang="php">
#!/usr/bin/php
<?php
Line 2,000:
else
@readfile('notes.txt');
</syntaxhighlight>
</lang>
Note that the error suppression operator (@) is considered bad coding practice.
 
Line 2,016:
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
 
(load "@lib/misc.l")
Line 2,022:
(out "+notes.txt" (prinl (stamp) "^J^I" (glue " " @)))
(and (info "notes.txt") (in "notes.txt" (echo))) )
(bye)</langsyntaxhighlight>
 
=={{header|PL/I}}==
<langsyntaxhighlight PLlang="pl/Ii">NOTES: procedure (text) options (main); /* 8 April 2014 */
declare text character (100) varying;
declare note_file file;
Line 2,061:
put file (note_file) skip;
put skip list ('The file, NOTES.TXT, has been created');
end NOTES;</langsyntaxhighlight>
 
=={{header|PowerShell}}==
<langsyntaxhighlight lang="powershell">$notes = "notes.txt"
if (($args).length -eq 0) {
if(Test-Path $notes) {
Line 2,072:
Get-Date | Add-Content $notes
"`t" + $args -join " " | Add-Content $notes
}</langsyntaxhighlight>
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">#FileName="notes.txt"
Define argc=CountProgramParameters()
If OpenConsole()
Line 2,098:
EndIf
EndIf
EndIf</langsyntaxhighlight>
 
=={{header|Python}}==
<langsyntaxhighlight lang="python">import sys, datetime, shutil
 
if len(sys.argv) == 1:
Line 2,112:
with open('notes.txt', 'a') as f:
f.write(datetime.datetime.now().isoformat() + '\n')
f.write("\t%s\n" % ' '.join(sys.argv[1:]))</langsyntaxhighlight>
 
'''Sample notes.txt file'''
Line 2,123:
 
=={{header|R}}==
<langsyntaxhighlight Rlang="r">#!/usr/bin/env Rscript --default-packages=methods
 
args <- commandArgs(trailingOnly=TRUE)
Line 2,134:
cat(file=conn, date(), "\n\t", paste(args, collapse=" "), "\n", sep="")
}
close(conn)</langsyntaxhighlight>
 
=={{header|Racket}}==
 
<syntaxhighlight lang="racket">
<lang Racket>
#!/usr/bin/env racket
#lang racket
Line 2,153:
(date->string (current-date) #t)
(string-join notes))))))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
 
<syntaxhighlight lang="raku" perl6line>my $file = 'notes.txt';
 
multi MAIN() {
Line 2,168:
$fh.say: DateTime.now, "\n\t", @note;
$fh.close;
}</langsyntaxhighlight>
 
=={{header|REBOL}}==
<langsyntaxhighlight REBOLlang="rebol">REBOL [
Title: "Notes"
URL: http://rosettacode.org/wiki/Take_notes_on_the_command_line
Line 2,182:
] [
write/binary/append notes rejoin [now lf tab args lf]
]</langsyntaxhighlight>
 
{{out|Sample session}}
Line 2,199:
 
=={{header|REXX}}==
<langsyntaxhighlight lang="rexx">/*REXX program implements the "NOTES" command (append text to a file from the C.L.).*/
timestamp=right(date(),11,0) time() date('W') /*create a (current) date & time stamp.*/
nFID = 'NOTES.TXT' /*the fileID of the "notes" file. */
Line 2,213:
call lineout nFID,tab||arg(1) /* " " text " " " */
end
/*stick a fork in it, we're all done. */</langsyntaxhighlight>
 
=={{header|Ruby}}==
<langsyntaxhighlight lang="ruby">notes = 'NOTES.TXT'
if ARGV.empty?
File.copy_stream(notes, $stdout) rescue nil
else
File.open(notes, 'a') {|file| file.puts "%s\n\t%s" % [Time.now, ARGV.join(' ')]}
end</langsyntaxhighlight>
 
=={{header|Rust}}==
This uses version 0.4 of the <code>chrono</code> crate
<langsyntaxhighlight Rustlang="rust">extern crate chrono;
 
use std::fs::OpenOptions;
Line 2,268:
add_to_notes(&note.join(" ")).expect("failed to write to NOTES.TXT");
}
}</langsyntaxhighlight>
 
=={{header|Scala}}==
{{libheader|Scala}}
<langsyntaxhighlight lang="scala">import java.io.{ FileNotFoundException, FileOutputStream, PrintStream }
import java.time.LocalDateTime
 
Line 2,290:
}
}
}</langsyntaxhighlight>
 
=={{header|Scheme}}==
(moved from Racket)
{{works with|Racket}}
<langsyntaxhighlight lang="scheme">#lang racket
(require racket/date)
(define *notes* "NOTES.TXT")
Line 2,314:
(fprintf fo "~a~n\t~a~n" dt ln)))
#:mode 'text #:exists 'append)
]))</langsyntaxhighlight>
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
$ include "getf.s7i";
$ include "time.s7i";
Line 2,339:
end if;
end if;
end func;</langsyntaxhighlight>
 
=={{header|Sidef}}==
<langsyntaxhighlight lang="ruby">var file = %f'notes.txt'
 
if (ARGV.len > 0) {
Line 2,351:
var fh = file.open_r
fh && fh.each { .say }
}</langsyntaxhighlight>
{{out}}
<pre>
Line 2,365:
=={{header|SNOBOL4}}==
{{works with|Macro SNOBOL4 in C}}
<langsyntaxhighlight lang="snobol">#! /usr/local/bin/snobol4 -b
a = 2 ;* skip '-b' parameter
notefile = "notes.txt"
Line 2,376:
notes = date()
notes = char(9) args
end</langsyntaxhighlight>
 
=={{header|Swift}}==
<langsyntaxhighlight Swiftlang="swift">import Foundation
 
let args = Process.arguments
Line 2,419:
 
let strData = str.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
handler?.writeData(strData!)</langsyntaxhighlight>
{{out}}
Example output
Line 2,430:
 
=={{header|Tcl}}==
<langsyntaxhighlight lang="tcl"># Make it easier to change the name of the notes file
set notefile notes.txt
 
Line 2,446:
close $f
}
}</langsyntaxhighlight>
{{out}} after a few runs:
<pre>
Line 2,458:
{{works with|R3}}
The lack of built-in high level time and date functions makes it more difficult than necessary, since they have to be implemented by user defined functions.
<syntaxhighlight lang="text">If Cmd (0) > 1 Then ' if there are commandline arguments
If Set (a, Open ("notes.txt", "a")) < 0 Then
Print "Cannot write \qnotes.txt\q" ' open the file in "append" mode
Line 2,517:
_Format Param (2) : Return (Join (Iif (a@<10, Join(b@, "0"), b@), Str (a@)))
_Monthdays Param (2) : Return (((a@ + (a@<7)) % 2) + 30 - ((2 - b@) * (a@=1)))
</syntaxhighlight>
</lang>
{{out}}
<pre>2022-04-02 14:58:57
Line 2,528:
=={{header|UNIX Shell}}==
Bash version
<langsyntaxhighlight lang="bash">#
NOTES=$HOME/notes.txt
if [[ $# -eq 0 ]] ; then
Line 2,535:
date >> $NOTES
echo " $*" >> $NOTES
fi</langsyntaxhighlight>
 
"Spoiled Bash kid" version
<langsyntaxhighlight lang="bash">N=~/notes.txt;[[ $# -gt 0 ]] && { date ; echo " $*"; exit 0; } >> $N || [[ -r $N ]] && cat $N</langsyntaxhighlight>
 
 
Portable version
<langsyntaxhighlight lang="bash">NOTES=$HOME/notes.txt
if test "x$*" = "x"
then
Line 2,552:
date >> $NOTES
echo " $*" >> $NOTES
fi</langsyntaxhighlight>
 
{{omit from|Retro}}
 
=={{header|Visual Basic .NET}}==
<langsyntaxhighlight lang="vbnet">Imports System.IO
 
Module Notes
Line 2,575:
End Try
End Function
End Module</langsyntaxhighlight>
 
=={{header|Wren}}==
Line 2,582:
An awkward task for Wren-cli which currently has no way of determining the current date and time.
We therefore have to ask the user to input it plus the note(s).
<langsyntaxhighlight lang="ecmascript">import "os" for Process
import "/ioutil" for File, FileUtil
import "/date" for Date
Line 2,597:
var note = "\t" + args[1..-1].join(" ") + "\n"
FileUtil.append("NOTES.TXT", dateTime.format(dateFormatOut) + "\n" + note)
}</langsyntaxhighlight>
 
{{out}}
Line 2,613:
=={{header|XPL0}}==
Checks for unlikely array overflows have been omitted for simplicity.
<langsyntaxhighlight XPL0lang="xpl0">include xpllib; \Date and Time routines
int I, NotesSize, Ch, CmdArgSize;
char Notes(1_000_000), CmdArg(1000);
Line 2,647:
Close(3);
];
]</langsyntaxhighlight>
 
{{out}}
Line 2,661:
=={{header|zkl}}==
File notes.zkl:
<langsyntaxhighlight lang="zkl">const notesName="NOTES.TXT";
args:=vm.arglist;
if (not args)
Line 2,669:
f.writeln(Time.Date.ctime(),"\n\t",args.concat(" "));
f.close();
}</langsyntaxhighlight>
{{out}}
<pre>
10,327

edits