summaryrefslogtreecommitdiffstats
path: root/dos2unix
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-06-14 09:11:56 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-06-14 09:11:56 +0200
commit2549822b7c29e8d0568020e7534fc2cf260a4547 (patch)
tree082298bf1323e542d8fa8c80323b377fd14d31a1 /dos2unix
parent63d088144fb8a956c2f7143e2a8ba1cd5806e780 (diff)
downloadbin-2549822b7c29e8d0568020e7534fc2cf260a4547.zip
bin-2549822b7c29e8d0568020e7534fc2cf260a4547.tar.gz
add dos2unix
Diffstat (limited to 'dos2unix')
-rwxr-xr-xdos2unix41
1 files changed, 41 insertions, 0 deletions
diff --git a/dos2unix b/dos2unix
new file mode 100755
index 0000000..3507582
--- /dev/null
+++ b/dos2unix
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+usage() {
+ echo "usage : `basename $0` [-rvx] name..."
+ echo " -r : recursive mode"
+ echo " -v : verbose mode"
+ echo " -x : force on executable"
+ echo " : files | directories list"
+}
+
+if test $# -lt 1 ; then
+ usage && exit 1;
+fi
+
+SED=`which sed 2>/dev/null`
+if test -z $SED; then echo "sed isn't available on this system."; exit 1; fi
+
+CMD="$SED -i -e s/\\r//g"
+R=0
+V=0
+X=0
+ARGS=""
+while test $# -gt 0; do
+ if test $1 == "-r"; then
+ R=1
+ elif test $1 == "-v"; then
+ V=1
+ elif test $1 == "-x"; then
+ X=1
+ echo "WARNING : force on executable is set."
+ echo " running this on a binary file will break it.";
+ echo " Hit ENTER to continue or Ctrl-C to Abort."; read OK
+ else
+ ARGS=$ARGS" "$1;
+ fi
+ shift;
+done
+
+. ~/bin/recurse_apply
+
+recurse_apply $ARGS