blob: b8dcf8f790de6c71df93dbe8b2960c053d85e345 [file] [log] [blame]
Jari Aalto726f6381996-08-26 18:22:31 +00001# C-shell compatabilty package.
2# setenv VAR VALUE
Jari Aaltoccc6cda1996-12-23 17:02:34 +00003function setenv ()
4{
Jari Aalto726f6381996-08-26 18:22:31 +00005 export $1="$2"
6}
7
Jari Aaltoccc6cda1996-12-23 17:02:34 +00008function unsetenv ()
9{
Jari Aalto726f6381996-08-26 18:22:31 +000010 unset $1
11}
12
Jari Aalto726f6381996-08-26 18:22:31 +000013# Can't write foreach yet. Need pattern matching, and a few extras.
14function foreach () {
15echo 'Can'\''t do `foreach'\'' yet. Type "help for".'
16}
17
18# Make this work like csh's. Special case "term" and "path".
19#set () {
20#}
21
Jari Aaltoccc6cda1996-12-23 17:02:34 +000022chdir ()
23{
24 builtin cd "$@"
25}
26
27# alias - convert csh alias commands to bash functions
28# from Mohit Aron <aron@cs.rice.edu>
29# posted to usenet as <4i5p17$bnu@larry.rice.edu>
30function alias ()
31{
32 if [ "x$2" = "x" ]
33 then
34 declare -f $1
35 else
Jari Aaltob80f6442004-07-27 13:29:18 +000036 case $2 in
37 *[#\!]*)
Jari Aaltoccc6cda1996-12-23 17:02:34 +000038 comm=$(echo $2 | sed 's/\\!\*/\"$\@\"/g
39 s/\\!:\([1-9]\)/\"$\1\"/g
40 s/#/\\#/g')
Jari Aaltob80f6442004-07-27 13:29:18 +000041 ;;
42 *)
43 comm="$2 \"\$@\"" ;;
44 esac
45
Jari Aaltoccc6cda1996-12-23 17:02:34 +000046 eval function $1 \(\) "{" command "$comm" "; }"
47 fi
48}