OS/2, eCS & ArcaOS - Technical > Utilities

touch?

(1/4) > >>

Rick Smith:
Greetings,

I am wondering if I can (from CLI) create a file?  In linux I would just say touch newfile, then I could nano and edit it.  On Arca I use file commander but I do not see a way to create a file (I could have missed it), touch does exist Ive noticed in Arca but does not act in how I would expect.  So basically I want to be able to create a new file in a directory using the CLI.

Regards,

Rick

Dariusz Piatkowski:
Hi Rick,


--- Code: ---[Y:\tmp]copy con: file2
test
^Z
        1 file(s) copied.

--- End code ---

...gets you the following:


--- Quote ---[Y:\tmp]dir

The volume label in drive Y is RAMDISK.
The Volume Serial Number is 5777:6CCF.
Directory of Y:\tmp

11-26-23  5:32p             6      0 a---  file2

--- End quote ---

Is that what you are looking to do?

BTW: I haven't tried any other combos, as in: "copy con: filename" but w/o actual input...

Tom:

--- Quote from: Rick Smith on November 26, 2023, 10:11:17 pm ---So basically I want to be able to create a new file in a directory using the CLI.

--- End quote ---

Maybe I misunderstand you, but I would expect the following to work:

cd <directory>
e (or tedit or epm or whichever editor)
start typing
use Save as and give it a filename (some editors might even allow you to start the editor with a desired file name which will be created if it doesn't exist already)

Another possibility:

cd <directory>
copy con: <filename>
start typing
Ctrl+Z


Lars:
echo. >newfile.txt

Dave Yeo:
touch new.file creates a new file here and it's how I usually create one with file commander.

--- Code: ---Directory of H:\tmp\test

11-26-23  3:06p         <DIR>      0 ----  .
11-26-23  3:06p         <DIR>      0 ----  ..
        2 file(s)           0 bytes used
                    4,755,963 K bytes free

[H:\tmp\test]touch new.file

[H:\tmp\test]dir

Volume in drive H has no label.
The Volume Serial Number is 4558:45C3.
Directory of H:\tmp\test

11-26-23  3:07p         <DIR>      0 ----  .
11-26-23  3:06p         <DIR>      0 ----  ..
11-26-23  3:07p             0    124 a---  new.file
        3 file(s)           0 bytes used
                    4,755,963 K bytes free

[H:\tmp\test]touch --version
touch (GNU coreutils) 8.31

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version