Download Game! Currently 85 players and visitors. Last logged in:RothanValkristBrurinCordoba

Blitzer's Blog >> 71722

Back to blogs index
Posted: 12 Aug 2026 09:11 [ permalink ]
Mesh OS v0.1 - Ydin ladattu. VFS kytketty.
Kokeile komentoja: ls, mkdir testi, echo "hello" >&2
mesh@local:~$ ls | grep etc
etc
mesh@local:~$ ll
etc
foo
mesh@local:~$ echo "foo bar fubar" | grep bu
mesh@local:~$ echo "foo bar fubar" | grep fu
foo bar fubar
mesh@local:~$ ls | grep foo | cat
foo
mesh@local:~$

==[ cmd.js ]==
/ a: argv, w: stdout, e: stderr, v: vfs, i: stdin
export const C = {
    echo: (a,w,e,v,i) => w(a.join(' ')),
    
    // cat osaa nyt lukea putkesta (i), jos tiedostoa ei anneta parametrinC$!
    cat: async(a,w,e,v,i) => a.length ? w(await v.readFile(a[0]).catch(x=>e(x.m
essage))) : w(i),
    
    ls: async(a,w,e,v,i) => w((await v.readdir(a[0]||'/')).join('
')),
    mkdir: async(a,w,e,v,i) => v.mkdir(a[0]).then(()=>w('ok')).catch(x=>e(x.mes
sage)),
    rm: async(a,w,e,v,i) => v.unlink(a[0]).then(()=>w('ok')).catch(x=>e(x.messa
ge)),
    
    // UUSI: grep suodattaa stdin-putkea (i) annettujen argumenttien
perusteella
    grep: (a,w,e,v,i) => {
        if (!i) return;
        const result = i.split('
').filter(line => line.includes(a[0]));
        if (result.length) w(result.join('
'));
    },

    ll: "ls", md: "mkdir"
};