Posts

Showing posts with the label bash

How to confuse ssh

I'm sure there are lots of ways to confuse ssh, just like there lots of ways to confuse me. But this is the one i found. At work we run Solaris with lots of old tools. I end up building lots of new stuff for my self and then having to work around the old ones. When I worked in a Irix shop, I had to do the same thing but for different reasons. One of the oddities that I run into is that our login shells are often csh. I like bash or ksh in a pinch. Well this means that I had to hack together a .cshrc that checks for bash and then execs it, leaving me with a perfect world of bash. It looks something like this: if ( $_ == "/bin/which" || $_ == "/usr/bin/which" ) then set which="true" endif set BASH = "$PWD/bin/bash" if ( -x $BASH && $which != "true" ) then exec $BASH endif set BASH = "/usr/bin/bash" if ( -x $BASH && $which != "true" ) then exec $BASH endif Well ssh does not like t...

Weird make/gmake error

When gmake'ing tools, I started to get strange errors like: /bin/bash: complete: command not found /bin/bash: /home/users/lcarmich/etc/bash_completion: line 220: syntax error near unexpected token `((' What I forget is that I build my own newer bash version (3.x) to be able to use the shell completions (and many other features) and the system default is 2.x. Don't ask about that. But gmake grabs the shell first in your path (older bash in my case). I found that you can grab different version parts from bash in the BASH_VERSINFO array. Well I only really care about major version and this is available in variable BASH_VERSINFO or array element 0 BASH_VERSINFO[0] I updated my bashrc to check version then load completions: if [ -r $BASH_COMPLETION -a $BASH_VERSINFO -ge 3 ]; then . $BASH_COMPLETION fi For future reference you can get array elements in bash with ${VARNAME[INDEX]} . For example: mnsdev11 (netcat-0.7.1)$ echo $BASH_VERSION 3.2.0(1)-release mnsdev11 (netcat-0.7.1)...