JanetDocsPlaygroundI'm feeling luckyGitHub sign in

os/shell



    cfunction
    src/core/os.c on line 1138, column 1

    (os/shell str)

    Pass a command string str directly to the system shell.


3 examplesSign in to add an example
Loading...
(os/shell "seq 12 | head -n 1") # => 1
jgartePlayground
(os/shell "uptime > /tmp/uptime.txt")  # => 0
(slurp "/tmp/uptime.txt")
# => @"22:33  up 5 days,  9:34, 15 users, load averages: 1.93 1.74 1.59\n"
(os/rm "/tmp/uptime.txt")  # => nil
cellularmitosisPlayground
(os/shell "uptime")  # => 0
# printed to the console:
22:30  up 5 days,  9:31, 15 users, load averages: 1.48 1.50 1.49
cellularmitosisPlayground