| Line | |
|---|
| 1 | # xalias - convert csh alias commands to bash functions
|
|---|
| 2 | # from Mohit Aron <[email protected]>
|
|---|
| 3 | # posted to usenet as <[email protected]>
|
|---|
| 4 | function xalias ()
|
|---|
| 5 | {
|
|---|
| 6 | if [ "x$2" = "x" ]
|
|---|
| 7 | then
|
|---|
| 8 | declare -f $1
|
|---|
| 9 | else
|
|---|
| 10 | case $2 in
|
|---|
| 11 | *[#\!]*)
|
|---|
| 12 | comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
|
|---|
| 13 | s/\\!:\([1-9]\)/\"$\1\"/g
|
|---|
| 14 | s/#/\\#/g')
|
|---|
| 15 | ;;
|
|---|
| 16 | *)
|
|---|
| 17 | comm="$2 \"\$@\"" ;;
|
|---|
| 18 | esac
|
|---|
| 19 |
|
|---|
| 20 | eval function $1 \(\) "{" command "$comm" "; }"
|
|---|
| 21 | fi
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.