shell

command
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Shell shows how to use the Embedded Go virtual filesystem.

Two different filesystems are used here. First one is the console filesystem you can find in fs/termfs package. It implemnts os.Stdin and os.Stdout files as the Go runtime expects. The second one is the in RAM filesystem you can find in the fs/ramfs package. This program allows to mount a mulitple such filesystems and work with files through them.

Example:

date!> date
1970-01-01 00:33:23 UTC
date!> help date

date
date YYYY-MM-DD hh:mm:ss
date!> date 2023-04-06 13:15:11
> date
2023-04-06 13:15:19 UTC
> help mount
mount
mount FSTYPE(FSARGS) PREFIX
Supported filesystems:

ramfs(SIZE[,NAME])  in RAM file system

> mount ramfs(512,FS1) /myfs
> mount ramfs(100,FS2) /mnt/fs2
> mount

prefix                    fstype     fsname      opencnt available      used
----------------------------------------------------------------------------
/dev/console              term       UART3             2         0        -1
/myfs                     ram        FS1               0       512         0
/mnt/fs2                  ram        FS2               0       100         0
> echo Hello World >/myfs/file1.txt
> mount

prefix                   fstype     fsname      opencnt available      	used
----------------------------------------------------------------------------
/dev/console              term       UART3             2         0        -1
/myfs                     ram        FS1               0       428        84
/mnt/fs2                  ram        FS2               0       100         0
> ls /myfs
-rw-rw-rw-      13 2023-04-06 13:16:25 UTC file1.txt
> cat /myfs/file1.txt
Hello World
>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL