• Uncategorized
  • 0

Xonsh library – Python and Shell syntax interoperability

Hits: 0

1. Installation

#!/usr/bin/env xonsh

ls

print('removing files')
rm {{EJS0}}

ls

print('adding files')
# This is a comment
for i, x in enumerate("xonsh"):
    echo @(x) > @("file{0}.txt".format(i))

print($(ls).replace('\n', ' '))

2. Main functions

3. Example

file name:test.xsh

test.xsh
removing files
rm: file\d+.txt: No such file or directory
test.xsh
adding files
file0.txt file1.txt file2.txt file3.txt file4.txt test.xsh

Operation mode

xonsh test.xsh

operation result

test.xsh
removing files
rm: file\d+.txt: No such file or directory
test.xsh
adding files
file0.txt file1.txt file2.txt file3.txt file4.txt test.xsh

references

You may also like...

Leave a Reply

Your email address will not be published.