botgram / shell-bot

:robot: Telegram bot that executes commands and sends the live output
GNU General Public License v3.0
797 stars 488 forks source link

alias usage #2

Open elanozturk opened 6 years ago

elanozturk commented 6 years ago

is there any way to use run command with the alias in .bashrc?

mildsunrise commented 6 years ago

I'm not sure what you mean. If you have an alias defined in your ~/.bashrc:

alias ll='ls -l'

then you can use it, i.e. /run ll.

avissian commented 6 years ago

You must change the shell to bash for the user, or run the command /shell for the current bot instance. See "{you linux dist name} change default shell to user" in google. My Raspberry Pi with raspbian starts with sh, and .bashrc is't loaded. I set first line "/bin/bash" in file /etc/shells and now bot start with bash shell

mildsunrise commented 6 years ago

oh, didn't think about that, thanks for chiming in ^^

wjs commented 5 years ago

Hi, I have the same issue with zsh. I use on-my-zsh, and have some alias in my .zshrc. The aliases work well on my computer. But when I use the bot, I got the following messages:

$ xxx
zsh:1: command not found: xxx
⛔️ Exited with 127.

The result of /shell is

Current shell: /usr/bin/zsh

Other shells:
/bin/sh
/bin/bash
/bin/zsh
/usr/bin/git-shell

Does anyone get it works?

mildsunrise commented 5 years ago

Update! A while ago I disabled interactive mode by default, because some shells (such as fish) are buggy with it.

If you want aliases to work, you have to enable interactive mode with /setinteractive :)

wjs commented 5 years ago

It works like a charm! Thanks!

marcuzz0 commented 2 years ago

Hi,

is it possible to set an alias for a command without typing "/r command" each time but only "command"? For example instead of "/r ls" only "ls"?