|
|
# Execution of external commands
|
|
|
## Execution of external commands
|
|
|
|
|
|
`hopeless
|
|
|
|
|
|
>: lines(read("!uname"));
|
|
|
|
|
|
>> ["Linux"] : list (list char)
|
|
|
|
|
|
>: lines(read("!ls /"));
|
|
|
|
|
|
>> ["bin", "boot", "cdrom", "dev", "disk", "etc", "home", "initrd.img", "initrd.img.old", "lib", "lost+found", "media", "mnt", "proc", "root", "sbin", "selinux", "srv", "sys", "tmp", "usr", "var", "vmlinuz", "vmlinuz.old"] : list (list char)
|
|
|
`
|
|
|
Function `read` in Hopeless has an ability to execute external commands and return its output as result of function `read`. To divide output to separate lines you need to use function 'lines' from module 'lines.hop':
|
|
|
|
|
|
hopeless
|
|
|
>: use lines;
|
|
|
>: lines(read("!uname"));
|
|
|
>> ["Linux"] : list (list char)
|
|
|
>: lines(read("!ls /"));
|
|
|
>> ["bin", "boot", "cdrom", "dev", "disk", "etc", "home", "initrd.img", "initrd.img.old", "lib", "lost+found", "media", "mnt", "proc", "root", "sbin", "selinux", "srv", "sys", "tmp", "usr", "var", "vmlinuz", "vmlinuz.old"] : list (list char) |