-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmmaxima
More file actions
executable file
·32 lines (28 loc) · 1.31 KB
/
mmaxima
File metadata and controls
executable file
·32 lines (28 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
### Script that calls maxima on a terminal. It uses **rlwrap** for
### history and built-ins file (also for getline). It is based on **rmaxima**
### but it has a few improvements.
### Depends on [maxima](http://maxima.sourceforge.net/).
# check if rlwrap is installed
RLWRAP=rlwrap
if [ ! "$(command -v "$RLWRAP")" ]; then
echo "$0 error: mmaxima requires rlwrap." >& 1
echo "rlwrap is available from <https://github.com/hanslub42/rlwrap>." >& 1
exit 1
fi
# get the maxima builtins list file
MAXIMA_BUILTINS="$MAXIMA_USERDIR"/maxima-builtins-list.txt
if [ ! -f "$MAXIMA_BUILTINS" ]; then
MAXIMA_SHAREDIR="$(find '/usr/share/maxima/' -maxdepth 2 -type d | grep 'share$')"
MAXIMA_BUILTINS="$MAXIMA_SHAREDIR"/maxima-builtins-list.txt
fi
# set history file location
MAXIMA_HISTORY="$MAXIMA_USERDIR"/maxima-history
# run maxima
if [ -f "$MAXIMA_BUILTINS" ]; then
exec rlwrap -a -c -b '(){}[].,*/+-=&^$#@\;|´`:' -H "$MAXIMA_HISTORY" -f "$MAXIMA_BUILTINS" -r -D 2 maxima --disable-readline "$@"
else
echo "$0: failed to locate list of built-in symbols; go ahead without it."
echo "$0: (I thought it might be $MAXIMA_USERDIR/maxima-builtins-list.txt or $MAXIMA_BUILTINS but there are no such files.)"
exec rlwrap -a -c -b '(){}[].,*/+-=&^$#@\;|´`:' -H "$MAXIMA_HISTORY" -r -D 2 maxima --disable-readline "$@"
fi