.bashrc and source command
Hey, I’m wondering if it’s currently possible to create aliases. I added a .bashrc file and a .profile file and neither one seems to get sourced when I open the app. There is also no source command available.
Just wondering if I’m missing something or if this is currently not possible. Thanks!
You did not miss anything. It is currently not possible to add aliases, but it's on the todo list.
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?
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".
Oh damn… I thought I could just throw in some nice shell scripts. ;)
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.
Hi, another update. With version 1.6.6, we now have "alias".
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?
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.
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.
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.
Okay ! Thank you a lot :)
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 ?
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?
Okay, I retry today on my IPAD (Ipad OS15) and, now, the alias work ! So thank you !
It seems that now both source command and alias work, so maybe this issue is ripe for closing?
Note that . does not work with the standard shell, while in contrast dash uses . and not source. It seems that . is POSIX and source is not. https://stackoverflow.com/questions/11588583/is-the-shells-source-posix-standard