- 论坛徽章:
- 0
|
刚学shell,自己写了点命令让各种命令的输出有了颜色显示,但现在碰到了一个问题如果我把它导入文件或者是给grep使用,会多一大堆[[2:32m等表示颜色的字符,怎样才可以去掉他们呢?
如^[[0;0m? root_fs^[[0;0m
^[[0;0m? um_lib.list^[[0;0m
^[[0;0m? xx^[[0;0m
^[[1;32mIndex: mkfs.sh^[[0;0m
^[[1;32m===================================================================^[[0;0m
^[[1;32mRCS file: /home/cvsadmin/sbu-i/neutral_trunk/tools/mkfs.sh,v^[[0;0m
^[[1;32mretrieving revision 1.3^[[0;0m
^[[1;32mdiff -u -b -B -r1.3 mkfs.sh^[[0;0m
^[[1;31m--- mkfs.sh 11 Jul 2008 00:59:03 -0000 1.3^[[0;0m
^[[1;34m+++ mkfs.sh 6 Aug 2008 02:56:28 -0000^[[0;0m
^[[1;35m@@ -30,7 +30,7 @@^[[0;0m
^[[0;0m rm -f $FS_NAME^[[0;0m
^[[0;0m fi^[[0;0m
^[[0;0m else^[[0;0m
^[[1;31m- dd if=/dev/zero of=./root_fs bs=1M count=320 ^[[0;0m
^[[1;34m+ dd if=/dev/zero of=./root_fs bs=1M count=64 ^[[0;0m
^[[0;0m fi^[[0;0m
^[[0;0m ^[[0;0m
^[[0;0m umount /mnt^[[0;0m
^[[0m
我想要的效果是:
? root_fs
? um_lib.list
? xx
Index: mkfs.sh
===================================================================
RCS file: /home/cvsadmin/sbu-i/neutral_trunk/tools/mkfs.sh,v
retrieving revision 1.3
diff -u -b -B -r1.3 mkfs.sh
--- mkfs.sh 11 Jul 2008 00:59:03 -0000 1.3
+++ mkfs.sh 6 Aug 2008 02:58:04 -0000
@@ -30,7 +30,7 @@
rm -f $FS_NAME
fi
else
- dd if=/dev/zero of=./root_fs bs=1M count=320
+ dd if=/dev/zero of=./root_fs bs=1M count=64
fi
umount /mnt |
|