Skip to main content

Paste and run commands from bash, zsh, fish in xonsh shell.

Project description

Paste and run commands from bash, zsh, fish in xonsh shell.

If you like the idea click ⭐ on the repo and stay tuned.

Install

xpip install -U xontrib-sh
echo 'xontrib load sh' >> ~/.xonshrc
# Reload xonsh

Usage

Start a line with an exclamation point — ! — then paste the sh-compatible commands after it and run. The command syntax will be tested in installed shells (bash, zsh, fish, sh) and the commands will be run in the first matching shell.

The commands will be executed in the environment that will be inherited from current but if the commands modify the environment there will no changes in source xonsh environment.

Use cases

One line: brace expansion (bash syntax)

! echo 01.{05..10}
bash:
01.05 01.06 01.07 01.08 01.09 01.10

Many lines: for loop (zsh syntax)

! for x (1 2 3); do 
  echo $x; 
done

for x (4 5 6); do 
  echo $x; 
done
zsh:
1
2
3
4
5
6

Set certain shell for all commands

$XONTRIB_SH_SHELLS = ['zsh']

Credits

This package was created with xontrib cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-sh-0.0.4.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

xontrib_sh-0.0.4-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page