Ble.sh: Errors while using ble

Created on 23 Oct 2020  ·  8Comments  ·  Source: akinomyoga/ble.sh

Hello! I have a problem with ble.sh: errors are shown after some commands (like bash) in terminal.

stty: 'standard input': unable to perform all requested operations
ble.sh (--rcfile): '/Users/alvinseville7cf/.blerc' is not a regular file.

I've installed ble.sh via:

git clone --recursive https://github.com/akinomyoga/ble.sh.git
cd ble.sh
make
make INSDIR="$HOME/.local/share/blesh" install

My ~/.bashrc is:

get_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

[[ $- == *i* ]] && source "$HOME/.local/share/blesh/ble.sh" --rcfile "$HOME    /.blerc"

export PATH="/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export PS1='\[\e[32;1m\]\u\[\e[0m\]@\[\e[34m\]\h\[\e[0m\] \[\e[35m\]\W\[\e[0m\] \[\e[33m\]$(get_git_branch)\[\e[0m\]$ '
export PS2='\[\e[90m\]>\[\e[0m\]'

((_ble_bash)) && ble-attach
question

All 8 comments

Thank you for the report! It seems your operating system is macOS. I'm going to reply based on this assumption. If this is not right, please correct me.

stty error messages

The first error message is produced when the system command stty is overwritten by the GNU binaries according to this Q&A [Edit: This is another case on GitHub]. In fact the following line in your .bashrc seems to replace stty with /usr/local/opt/coreutils/lbiexec/gnubin/stty:

export PATH="/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"

One needs to make sure that the system /bin/stty is kept while other utilities are replaced by the ones from coreutils. There are several ways to achieve this, but for example you can create a new bin directory in which you have a symbolic link to the system stty and make it precede to gnubin in PATH. This is the example to set up in such a way (please replace ~/.local/bin with your preferred location):

$ mkdir -p ~/.local/bin
$ cd ~/.local/bin
$ ln -sf /bin/stty stty

Then, the following line can be added after the export PATH=... line in your .bashrc:

 export PATH="/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
+PATH=~/.local/bin:$PATH
 export PS1='\[\e[32;1m\]\u\[\e[0m\]@\[\e[34m\]\h\[\e[0m\] \[\e[35m\]\W\[\e[0m\] \[\e[33m\]$(get_git_branch)\[\e[0m\]$ '
 export PS2='\[\e[90m\]>\[\e[0m\]'

If that doesn't solve the problem, could you please provide the output of the following commands?

$ echo $MACHTYPE
$ echo $BASH_VERSION
$ tty
$ stty -a
$ type stty

rcfile

The option --rcfile "$HOME/.blerc" for source ble.sh can only be specified when you actually have the file $HOME/.blerc. If you don't have the file, you can just omit the option:

-[[ $- == *i* ]] && source "$HOME/.local/share/blesh/ble.sh" --rcfile "$HOME/.blerc"
+[[ $- == *i* ]] && source "$HOME/.local/share/blesh/ble.sh"

If you have a rcfile, can you first check the path of the rcfile?

Hi @alvinseville7cf, did you solve the problem?

@akinomyoga, unfortunately no:

alvinseville7cf@Alvins-MacBook-Pro Temp $ true
stty: 'standard input': unable to perform all requested operations

~/.bashrc:

get_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

[[ $- == *i* ]] && source "$HOME/.local/share/blesh/ble.sh" # I don't have $HOME/.blerc

export PATH="~/.local/bin:/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export PS1='\[\e[32;1m\]\u\[\e[0m\]@\[\e[34m\]\h\[\e[0m\] \[\e[35m\]\W\[\e[0m\] \[\e[33m\]$(get_git_branch)\[\e[0m\]$ '
export PS2='\[\e[90m\]>\[\e[0m\]'

((_ble_bash)) && ble-attach
  • $MACHTYPE = x86_64-apple-darwin17.7.0
  • $BASH_VERSION = 5.0.18(1)-release
  • tty = /dev/ttys000
  • stty -a =
    speed 38400 baud; 28 rows; 141 columns;
    lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
    iflags: -istrip icrnl -inlcr -igncr -ixon -ixoff ixany imaxbel iutf8
    -ignbrk brkint -inpck -ignpar -parmrk
    oflags: opost onlcr -oxtabs -onocr -onlret
    cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
    cchars: discard = ; dsusp = ; eof = ^D; eol = ;
    eol2 = ; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;
  • type stty = stty is hashed (/Users/alvinseville7cf/.local/bin/stty)

OK, thank you for your additional information!

Can you replace ~ with $HOME in the following line (or remove double quotations ")? The tilde ~ will not be expanded to your home directory when it is quoted inside "...".

-export PATH="~/.local/bin:/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
+export PATH="$HOME/.local/bin:/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"

I'm sorry, but I still don't get what happens here. Could you also provide me the result of the following commands (after the above change in .bashrc and a restart of Bash)?

$ hash -r
$ type -p stty
$ ls -la $(type -p stty)
$ stty sane
$ ls -la /bin/stty
$ /bin/stty sane
$ command -p stty sane
alvinseville7cf@Alvins-MacBook-Pro ~ $ hash -r
stty: 'standard input': unable to perform all requested operations
alvinseville7cf@Alvins-MacBook-Pro ~ $ type -p stty
stty: 'standard input': unable to perform all requested operations
/Users/alvinseville7cf/.local/bin/stty
alvinseville7cf@Alvins-MacBook-Pro ~ $ ls -la $(type -p stty)
stty: 'standard input': unable to perform all requested operations
lrwxr-xr-x 1 alvinseville7cf staff 9 Nov  2 18:03 /Users/alvinseville7cf/.local/bin/stty -> /bin/stty
alvinseville7cf@Alvins-MacBook-Pro ~ $ stty sane
stty: 'standard input': unable to perform all requested operations
alvinseville7cf@Alvins-MacBook-Pro ~ $ ls -la /bin/stty
stty: 'standard input': unable to perform all requested operations
-rwxr-xr-x 1 root wheel 32208 Sep 11 13:16 /bin/stty
alvinseville7cf@Alvins-MacBook-Pro ~ $ /bin/stty sane
stty: 'standard input': unable to perform all requested operations
alvinseville7cf@Alvins-MacBook-Pro ~ $ command -p stty sane
stty: 'standard input': unable to perform all requested operations

OK, I see. Maybe you have the setting for PATH also in another place. PATH needs to be set up before the source of ble.sh.

 get_git_branch() {
   git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
 }

+export PATH="$HOME/.local/bin:/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
+
 [[ $- == *i* ]] && source "$HOME/.local/share/blesh/ble.sh" # I don't have $HOME/.blerc

-export PATH="$HOME/.local/bin:/usr/local/Cellar/nano/5.3/:/usr/local/opt/coreutils/libexec/gnubin:$PATH"
 export PS1='\[\e[32;1m\]\u\[\e[0m\]@\[\e[34m\]\h\[\e[0m\] \[\e[35m\]\W\[\e[0m\] \[\e[33m\]$(get_git_branch)\[\e[0m\]$ '
 export PS2='\[\e[90m\]>\[\e[0m\]'

 ((_ble_bash)) && ble-attach

It seems to work! ;) Many thanks.

Thank you! I close this issue.

Was this page helpful?
0 / 5 - 0 ratings