diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:38:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:38:56 +0000 |
commit | 6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321 (patch) | |
tree | f63ce19d57fad3ac4a15bc26dbfbfa2b834111b5 /examples/functions/csh-compat | |
parent | Initial commit. (diff) | |
download | bash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.tar.xz bash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.zip |
Adding upstream version 5.2.15.upstream/5.2.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/functions/csh-compat')
-rw-r--r-- | examples/functions/csh-compat | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/functions/csh-compat b/examples/functions/csh-compat new file mode 100644 index 0000000..6671ca8 --- /dev/null +++ b/examples/functions/csh-compat @@ -0,0 +1,48 @@ +# C-shell compatibility package. +# setenv VAR VALUE +function setenv () +{ + export $1="$2" +} + +function unsetenv () +{ + unset $1 +} + +# Can't write foreach yet. Need pattern matching, and a few extras. +function foreach () { +echo 'Can'\''t do `foreach'\'' yet. Type "help for".' +} + +# Make this work like csh's. Special case "term" and "path". +#set () { +#} + +chdir () +{ + builtin cd "$@" +} + +# alias - convert csh alias commands to bash functions +# from Mohit Aron <aron@cs.rice.edu> +# posted to usenet as <4i5p17$bnu@larry.rice.edu> +function alias () +{ + if [ "x$2" = "x" ] + then + declare -f $1 + else + case $2 in + *[#\!]*) + comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g + s/\\!:\([1-9]\)/\"$\1\"/g + s/#/\\#/g') + ;; + *) + comm="$2 \"\$@\"" ;; + esac + + eval function $1 \(\) "{" command "$comm" "; }" + fi +} |