Giter Site home page Giter Site logo

Comments (5)

maxonthegit avatar maxonthegit commented on September 15, 2024

I assume you put $NETKIT_HOME/bin/netkit_bash_completion (i.e., not
$NETKIT_HOME/check_configuration.sh) in your .bashrc.

If this is the case, the error you are seeing might be due to the fact
that you are using dash as your system shell. If it's not a problem, you
can change it system-wide by using the following command:

ln -fs bash /bin/sh

Il 18/11/16 15:45, alexandrehuat ha scritto:

Hello,
I followed the installation guide and netkit was installed without an
error. I then put the command line |.
$NETKIT_HOME/check_configuration.sh| in my .bashrc.
When opening a new terminal I receive the following error :

|bash: /opt/netkit/bin/netkit_bash_completion: line 129: syntax error
near unexpected token (' bash: /opt/netkit/bin/netkit_bash_completion: line 129: --eth+([0-9]))' |

I don't know how to fix it.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#35, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAvHJYSY7Dd5jfKY8tGDdattVqXFNbNTks5q_bolgaJpZM4K2jZc.

from netkit-core.

alexandrehuat avatar alexandrehuat commented on September 15, 2024

I assume you put $NETKIT_HOME/bin/netkit_bash_completion

Oh, yes! I made a copy-paste mistake...

On your advise, I executed

sudo ln -fs bash /bin/sh
$NETKIT_HOME/bin/netkit_bash_completion

but it didn't change anything, I still get the same error at line 129. I manipulated a bit the parenthesis, it didn't change nothing either. However I don't understand why the system detects an error since your code seems ok for me. I looked at the case man (since line 129 is a case), your regexp seems legit.

Here is $NETKIT_HOME/bin/netkit_bash_completion, line 126-131 (error at --eth+([0-9])))

case $PREV_CWORD in
      --con[01])
         _intelligent_space $(compgen -W "xterm this pty port: none" -- "$OPT_VAL");;
      --eth+([0-9]))
         WORDLIST="$(vlist -n | awk -v FS="@ *|, *" '{for (i=2; i<=NF; i+=2) {print $i}}' | sort | uniq) tap,"
         _intelligent_space $(compgen -W "$WORDLIST" -- "$OPT_VAL");;

from netkit-core.

maxonthegit avatar maxonthegit commented on September 15, 2024

Well, this is pretty strange.
Indeed, by looking again at your output, you were already using bash since the first attempt.

I can successfully process the script under consideration even using Cygwin's bash:

[Max@Puma desktop]$ bash --version
GNU bash, versione 4.3.46(7)-release (x86_64-unknown-cygwin)
Copyright (C) 2013 Free Software Foundation, Inc.
Licenza GPLv3+: GNU GPL versione 3 o successiva <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[Max@Puma desktop]$ . $NETKIT_HOME/bin/netkit_bash_completion
[Max@Puma desktop]$

I suggest you check that the SHA1 of the file matches the following:
8b073402a24189f539a9707b97039fb65e34591d *netkit_bash_completion
If not, maybe some unintented conversion has taken place on the file (e.g., after opening it with an editor that may have automatically converted newlines from the *nix to the DOS convention).
Aside from that, something else could be different in your setup (bash version maybe?)

from netkit-core.

alexandrehuat avatar alexandrehuat commented on September 15, 2024

I suggest you check that the SHA1 of the file matches the following:
8b073402a24189f539a9707b97039fb65e34591d *netkit_bash_completion

The SHA1 is :

$ sha1sum /opt/netkit/bin/netkit_bash_completion 
e57c52c1e68e9b6908e109dde0049c2fb53ed1ab  /opt/netkit/bin/netkit_bash_completion

It's not the same. But I think my problem is solved because bash autocompletion now works. I made the error of executing netkit_bash_completion instead of sourcing it. When sourcing the file, I don't get any error.
Thanks for your help! (and sorry for having bothered you)

from netkit-core.

maxonthegit avatar maxonthegit commented on September 15, 2024

No problem.

Just a quick comment to try to motivate the inconsistent behavior.

Successful processing of the --eth+([0-9]) regular expression relies on bash's extglob option being enabled. A few lines in the script (shopt -s extglob) take care of this, but unfortunately do it inside functions, that are only supposed to be executed when autocompletion is invoked. Not having this option enabled when these functions are being defined causes bash to fail: indeed, shopt -s extglob should have been used globally in the main body of the script.
This problem does not occur when the script is sourced instead, because in a number of cases bash already has the extglob option set:

$ bash -ic "shopt | grep extglob"
extglob         on

from netkit-core.

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.