Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash question



dan moylan wrote:
> running ubuntu 8.10.
> in my .profile file i had the following line:
>   hst=${HST:0:3}
> i was cited for a login error because of it, and couldn't
> log in until i changed the line to:
>   hst=`echo $HST | cut -c1-3`
> does anyone know why the first construction causes a
> problem?  once i'm logged in, both constructions work fine.

Probably because ubuntu uses a strict (non-bourne-again) 'sh' shell for some 
things (apparently .profile processing is one), but the shell you have for a 
terminal is 'bash'.

Other distros (I know at least redhat-based ones) have sh as just a symlink 
to bash, and don't do the 'strict sh' syntax by default even if arg[0] is 
'sh' instead of 'bash'.

So that .profile line might work on some linux systems and not others.

Matt






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org