Browse Source

Added two macro examples:

    * macro.6.sh - execute selected block
    * macro.7.sh - delete trailing whitespaces

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Ilia Maslakov 14 years ago
parent
commit
bc3c848ab1
3 changed files with 11 additions and 1 deletions
  1. 3 1
      misc/macros.d/Makefile.am
  2. 4 0
      misc/macros.d/macro.6.sh
  3. 4 0
      misc/macros.d/macro.7.sh

+ 3 - 1
misc/macros.d/Makefile.am

@@ -5,7 +5,9 @@ macro_DATA = \
 	macro.1.sh \
 	macro.3.sh \
 	macro.4.sh \
-	macro.5.sh
+	macro.5.sh \
+	macro.6.sh \
+	macro.7.sh
 
 EXTRA_DIST = \
     $(macro_DATA)

+ 4 - 0
misc/macros.d/macro.6.sh

@@ -0,0 +1,4 @@
+e       execute something
+        TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
+        cat %b > $TMPFILE
+        sh $TMPFILE > %b

+ 4 - 0
misc/macros.d/macro.7.sh

@@ -0,0 +1,4 @@
+w       delete trailing whitespace
+        TMPFILE=`mktemp ${MC_TMPDIR:-/tmp}/up.XXXXXX` || exit 1
+        cat %b > $TMPFILE
+        cat $TMPFILE | sed 's/[ \t]*$//' > %b