Coder Social home page Coder Social logo

Comments (3)

PodioSpaz avatar PodioSpaz commented on May 24, 2024 1

I have only been able to replicate the problem when using fully qualified paths. No problem with relative paths.

This works...

/🔒
❯ cd tmp/123 && ls

This works...

~
❯ cd ../../tmp/123 && ls

This does not...

/🔒
❯ cd /tmp/123 && ls

from xonsh.

JamesParrott avatar JamesParrott commented on May 24, 2024

Reproduced in an alpine:edge container:

<user>@bf5102635826 / # mkdir -p /tmp/abc /tmp/123 /tmp/a123
<user>@bf5102635826 / # cd /tmp/abc && ls
<user>@bf5102635826 /tmp/abc # cd /tmp/a123 && ls
<user>@bf5102635826 /tmp/a123 # cd /tmp/123 && ls
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
NameError: name 'cd' is not defined
<user>@bf5102635826 /tmp/a123 [1] # echo / 123 && ls
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
NameError: name 'echo' is not defined

And with XONSH_SHOW_TRACEBACK = True:

<user>@bf5102635826 / # cd /tmp/123 && ls
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'cd' is not defined

<user>@bf5102635826 / [1] # echo / 123 && ls
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'echo' is not defined

from xonsh.

JamesParrott avatar JamesParrott commented on May 24, 2024

I'm new to Xonsh. But "while all Python code is also xonsh, not all Bash code can be used in xonsh", I believe the correct behaviour is to change the && into a Python and.
https://xon.sh/tutorial.html#logical-subprocess-and

These errors occur with || too. And when replacing && with and, the echo treats the and as an arg, but the cd raises a different error:

<user>@bf5102635826 ~ # cd /tmp/123 || ls
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'cd' is not defined

<user>@bf5102635826 ~ [1] # echo /tmp/123 || ls
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'echo' is not defined
<user>@bf5102635826 ~ [1] # echo /tmp/123 and ls
/tmp/123 and
<user>@bf5102635826 ~ # cd /tmp/123 and ls
cd takes 0 or 1 arguments, not 2. An additional `-P` flag can be passed in first position to follow symlinks.
<user>@bf5102635826 ~ [1] #

from xonsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.