• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Using aliases with Terminal Emulator

Quisquose

Lurker
I'm new to Terminal Emulator, and I only have a tiny amount of Linux experience from having used Ubuntu & Mint for a short while several years ago.

Back when I was trying Linux, I created a text file with some aliases (which worked great). I'm just wondering how I can go about using those same aliases with Terminal Emulator on Android? I should mention that I am using a rooted Samsung Galaxy Tab S with a standard ROM (so I'm using sh and I don't think I have access to BASH).

I tried using the 'Initial Command' option in Terminal Emulator's preferences (to point to my alias text file) but I just get a 'can't Execute: Permission denied' message.

The permission on my alias text file is 770, and I tried changing it (using Total Commander as Root), but despite Total Commander saying that the permissions change was successful, when I go back and check the changes have not been applied and the file is still 770. This is regardless of which folder I happen to put the alias file in.

I don't even know whether changing the permissions would cause my alias file to be used (because I'm not too sure what Terminal Emulator's 'initial command' option does, or how that setting should be worded, so that's why I asking for help.

Does SH have an equivalent of bash.rc where things can be configured? What would be the best way for me to get access to the aliases that I have created?

Thanks
 
Did you try changing permissions using the terminal command (choose u+x file)? And if that didn't work, try as superuser (prefix the command with "sudo")?

By "alias file" do you mean a script in which you define some command aliases? Although I've used *nix operating systems since the 90s I don't recall meeting that term, so am a little unsure what you mean.

As for configuring your shell, I've never used the "initial command" option but logically it should execute the command you specify if it is an executable file. So give it the path of your script and see.
 
Many thanks for your reply.

Did you try changing permissions using the terminal command (choose u+x file)? And if that didn't work, try as superuser (prefix the command with "sudo")?
Yes, after it didn't work using Root in Total Commander, I then tried using Terminal instead.

I could not use sudo because (as I mentioned) I do not have bash, so I used SU instead. I know that this worked because the prompt turned from $ to # to indicate root. I then did a chmod 777 (as Root) and the command executed and returned to the prompt. This usually indicates that the command has worked but, yet again, when I checked the file it was still on 770. I also tried 775, but that didn't work either.

When I tried to chmod u+x, I just get a 'bad mode' response. The same if I tried a+x or just +x.

By "alias file" do you mean a script in which you define some command aliases? Although I've used *nix operating systems since the 90s I don't recall meeting that term, so am a little unsure what you mean.

Apologies from my questionable terminology. I may well be using the wrong word, but you have nevertheless exactly understood what I meant. Yes, it's basically a script with a bunch of alias commands defined in it. It's primarily so that I can use my own shortcuts (as well some DOS commands which I keep typing by mistake because it's what I'm used to).

For example some of them are:

alias dir='ls'
alias cls='clear && clear'
alias del='delete'
alias cd..='cd ..'
alias cd...='cd ../..'

etc.

As for configuring your shell, I've never used the "initial command" option but logically it should execute the command you specify if it is an executable file. So give it the path of your script and see.

That was what I tried in the first place, and it's what gave the 'permission denied' error message (which is why I embarked on trying to change the permissions on my 'alias' script file).
 
Back
Top Bottom