Download
scp vs. bashrc
Prepend this to .bashrc to make scp work.
It suppresses echoing to stdout in scp shells.
# disable echo when running for scp
if [ -z "$PS1" ] ; then
function echo {
while [ "$1" ] ; do
shift
done
}
fi
make alias
This alias takes the pain of DOS-formatted Makefiles away.
alias make='if [ `file Makefile | grep -c CRLF` != 0 ] ; then echo "Makefile contains CRLF, converting." ; dos2unix --quiet Makefile ; chmod 775 Makefile ; fi ; make'
d2u
Runs dos2unix on a file but will preserve the file's permissions.
Get the source
me shell
A polyglot script that runs on both Windows and UNIX.
@goto windows \
2>/dev/null
echo "Running on Linux/MacOS"
[... more bash commands here ...]
exit 0
:windows
@echo Running on Windows
[... more DOS commands here ...]
- If the script should be double-clickable from the Explorer, it needs an extension that Windows recognizes, e.g. ".cmd"
- If you don't give it any file extension, it should still run perfectly from the DOS shell.
- To run it in bash, it just needs the executable flag(s) set.