Coder Social home page Coder Social logo

.bashrc and source command about a-shell HOT 14 OPEN

holzschu avatar holzschu commented on May 30, 2024
.bashrc and source command

from a-shell.

Comments (14)

holzschu avatar holzschu commented on May 30, 2024 2

You did not miss anything. It is currently not possible to add aliases, but it's on the todo list.

from a-shell.

holzschu avatar holzschu commented on May 30, 2024 1

No, bash is not available. a-shell pretends to run /bin/sh, but is not actually running it (because coding that would be even harder, and for performance reasons). "Running a full shell" is on the TODO list, but it's a distant goal (see https://github.com/holzschu/a-shell/projects/1 ). Although the recent introduction of webAssembly might change that.

Shell scripts in the bin directory are not executed (I'd love to, but that is still too difficult), but python, lua and webAssembly files are executed. Since there are no real path for executable, the shebang rule is: "begins with "#!" and "contains the interpreter name".

from a-shell.

holzschu avatar holzschu commented on May 30, 2024 1

Ah, yes, that makes sense. There are two types of commands: "interactive" commands, that listen to stdin continuously, and "standard" commands, that listen to stdin once you press enter. The former is: less, more, vim, ssh, scp, ipython, man, the latter is anyone else. The detection is made based on the command name, so since vi is not in the list, it's not interactive (you could, maybe, escape vi by typing :wq + Enter).

I don't have a short-term fix for that. In implementing sftp, I've had the first command that changes state (starts as interactive for password entering, until you're connected, then becomes standard). I could probably revert that for aliases to interactive commands.

Update: alias vi vim now works.

from a-shell.

JayBrown avatar JayBrown commented on May 30, 2024

Is bash even available? If I execute echo $SHELL, a-shell prints /bin/sh.

Related question: What kind of shebang should we then put into shell scripts that go into one of the bin directories? #!/bin/sh?

from a-shell.

JayBrown avatar JayBrown commented on May 30, 2024

Oh damn… I thought I could just throw in some nice shell scripts. ;)

from a-shell.

holzschu avatar holzschu commented on May 30, 2024

Hi, just an update. With version 1.5:

  • the ".profile" file is now executed at the beginning of each session (if it exists).
  • a-Shell can be controlled with Shortcuts, and shortcuts can take a file (with a list of commands) as input; they can also have "if" branches and "for" loops.

On the other hand:

  • there are still no way to alias a command to another,
  • and still no way to execute shell programs from inside the App.

from a-shell.

holzschu avatar holzschu commented on May 30, 2024

Hi, another update. With version 1.6.6, we now have "alias".

from a-shell.

tompropst avatar tompropst commented on May 30, 2024

Hi, another update. With version 1.6.6, we now have "alias".

I created an alias for ls which works great however an alias for vi to vim does not. The file opens in vim however the key bindings seem broken. I have not been able to figure out how to exit in this state so have to kill a-shell. Any ideas what might be happening in this case?

from a-shell.

Lisandra-dev avatar Lisandra-dev commented on May 30, 2024

Just a little question for .profile :
It's normally vim ~/.profile to create and open it ? Because when I want to write to it I have "Can't open file for writing" when I try to save.

from a-shell.

holzschu avatar holzschu commented on May 30, 2024

One specificity of iOS is that you cannot write in ~, only in ~/Documents. So all configuration files, including .profile, have been moved to ~/Documents. It's ~/Documents/.profile, ~/Documents/.vimrc, ~/Documents/.ssh, etc.

from a-shell.

Lisandra-dev avatar Lisandra-dev commented on May 30, 2024

Okay ! Thank you a lot :)

from a-shell.

Lisandra-dev avatar Lisandra-dev commented on May 30, 2024

Okay, little update. I try to set an alias with alias key=command but it doesn't seem to work. I also try alias key command, but I have the same result.
What I am doing wrong ?

from a-shell.

holzschu avatar holzschu commented on May 30, 2024

Both syntax should work. Two questions: does it work in the terminal and fail in the .profile, and can you provide the actual command you tried?

from a-shell.

Lisandra-dev avatar Lisandra-dev commented on May 30, 2024

Okay, I retry today on my IPAD (Ipad OS15) and, now, the alias work !
So thank you !

from a-shell.

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.