bash question
Matthew Gillen
me-5yx05kfkO/aqeI1yJSURBw at public.gmane.org
Sat Jan 3 16:21:40 EST 2009
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
More information about the Discuss
mailing list