From 726f63884db0132f01745f1fb4465e6621088ccf Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Mon, 26 Aug 1996 18:22:31 +0000 Subject: Imported from ../bash-1.14.7.tar.gz. --- examples/alias-conv.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 examples/alias-conv.sh (limited to 'examples/alias-conv.sh') diff --git a/examples/alias-conv.sh b/examples/alias-conv.sh new file mode 100755 index 00000000..edbed865 --- /dev/null +++ b/examples/alias-conv.sh @@ -0,0 +1,22 @@ +#! /bin/sh +# +# Convert Csh aliases to Bash aliases. Adapted from a similar program +# supplied with zsh. +# +# This is a quick script to convert csh aliases to Bash aliases/functions. +# Pipe the output of csh's alias command through this; it will generate +# a series of alias/function definitions on stdout, suitable for +# processing by bash. +# +# This is not perfect, but it gets most common aliases; it should manage to +# cut down a lot of the busy work. +# +sed -e 's/ (\(.*\))/ \1/' >/tmp/cz$$.1 +grep ! /tmp/cz$$.1 >/tmp/cz$$.2 +grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3 +sed -e "s/'/'"\\\\"''"/g -e 's/^\([^ ]*\) \(.*\)$/alias \1='"'\2'/" \ + /tmp/cz$$.3 +sed -e 's/![:#]*/$/g' -e 's/^\([^ ]*\) \(.*\)$/\1 () { \2 }/' /tmp/cz$$.2 +rm /tmp/cz$$.? + +exit 0 -- cgit v1.2.1