os/windows/ CygWin
I'd not survive on Windows without CygWin. But Crlf issues are a problem with bash. To fix these, set SHELLOPTS
in your user environment variables to
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:monitor
Cygwin can make a mess of permissions, since permissions don't work in Windows in the same way as *nix. If all your cygwin activity happens within the C:\cygwin64\
space there is no problem, but if you routinely use cygwin outside of there (e.g. in your Windows home foloder), you want to edit /etc/fstab
and insert noacl
as below:
none /cygdrive cygdrive binary,posix=0,user,noacl 0 0
To have an equivalent of sudo
#!/usr/bin/bash
cygstart --action=runas "$@"
Importantly, sudo bash
gets you an bash with elevated privileges, which can be useful for running a lot of installers without multiple UAC alerts.
SSH Issues
When ssh'ing to a Windows machine, your login shell is cmd.exe
, which is not very useful. If you try and run C:\cygwin64\bin\bash
, then you'll find that your HOME
is set to e.g. C:\Users\mrflibble
and not /home/mrflibble
as it should be. My simple solution is the following combination of a .bat
file for cmd
to run, and a .sh
file for bash
which sets HOME
correctly and then exec
s bash.
@C:\cygwin64\bin\bash.exe cygbash.sh
and
export HOME=/home/"$USER"
exec /bin/bash --login