When I SSH into one of my servers where fish is my default shell, I get odd behaviors until I cd to another directory. I traced this back to the PWD environment variable being undefined when fish starts. The cd builtin is then the first to set it. You can even reproduce it by:
bash
unset PWD
fish
echo $PWD # no value
cd /home # you'll get errors from 'test' in the cd function
This doesn't seem right to me, as all other shells I used for comparison
initialize the PWD variable (replace fish with bash above, and $PWD gives the
proper directory). Attached is a patch that initializes PWD as I expect. Does
fish behave this way intentionally? If not, is this the best way to fix my
problem?
--
UNIX was not designed to stop you from doing stupid things, because that
would also stop you from doing clever things.
-- Doug Gwyn
*** fish-1.23.0-original/env.c 2008-01-12 20:47:44.000000000 -0500
--- fish-1.23.0/env.c 2008-06-24 16:09:51.386412038 -0400
***************
*** 500,509 ****
--- 500,518 ----
env_set( L"HOME", dir, ENV_GLOBAL );
free( dir );
free( unam_narrow );
}
+ if( !env_get( L"PWD" ) )
+ {
+ wchar_t cwd[4096];
+ wchar_t *res = wgetcwd( cwd, 4096 );
+ if( res )
+ {
+ env_set( L"PWD", cwd, ENV_EXPORT | ENV_GLOBAL );
+ }
+ }
}
void env_init()
{
char **p;
pgpsf5yQ8qpbX.pgp
Description: PGP signature
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
_______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
