(Video materials in preparation)
itouch : Initializes a file
Usage : itouch [-<n>] <string> <file1> <file2>...
: itouch [-<n>] -f <file> <file1> <file2>...
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
If the specified file is not found or is zero bytes, then its
contents are initialized with <string> or <file>.
If -<n> is specified as a number, then the file is initialized with
<n> lines of <string> or <n> times of <file>.
You can specify multiple files.
If the file exists and is larger than zero bytes, the command does
nothing.
If the file specified is "-" then the command reads standard input
and will output to standard output.
$ cat file
cat: file: No such file or directory <-- File doesn't exist
$ itouch '000 000 0' file
$ cat file
000 000 0 <-- Initialized with a string
$ itouch 'abc abc 0' file <-- File exists and is not
$ cat file empty
000 000 0
$ : > file
$ itouch -3 '000 000 0' file <-- 3 lines initialized
$ cat file
000 000 0
000 000 0
000 000 0
$ : > file
$ itouch 'a\nb\nc' file <-- '\n' is converted to
$ cat file newline
a
b
c
$ cat file1
$ cat file1 | itouch '000 0' - <-- Empty file is read from
000 0 standard input
$ cat file2
ABC D
$ cat file2 | itouch '000 0' - <-- A file with content is
ABC D read from standard input
ABC D
$ : > file
$ echo abc > init <-- "init" is an initialization file.
$ itouch -f init file <-- "file" is initialized by "init" file.
$ cat file
abc