Safely change home directory

前端 未结 12 2328
南旧
南旧 2020-12-12 10:22

I\'m trying to safely update the home directory as specified in /etc/passwd, but the standard Linux utils - usermod and vipw - for doing so aren\'t provided by

12条回答
  •  既然无缘
    2020-12-12 11:11

    I like to keep my cygwin installation sync'd to a pen drive and another computer, so I hate hard-coding the home directory. I use the following cygwin.bat:

    echo off
    SETLOCAL
    set SHELL=\\bin\\bash
    set HOME=%~dp0..\..\doc\unix
    bin\bash --login -i
    ENDLOCAL
    

    SETLOCAL and ENDLOCAL make sure that SHELL and HOME don't clobber existing env variables for other programs. HOME=%~dp0..\..\doc\unix sets HOME to be two directories up, in the doc/unix subdirectory. Then in ....\doc\unix.bashrc, I include PATH="/bin:/usr/local/bin:/usr/X11R6/bin:/usr/bin". I did not use start /wait %CD%\bin\bash to start bash, because I am using Console2, so I don't need an additional cmd window.

提交回复
热议问题