Can I alias a sage command?
If I type alias
, I get a list of aliases, but they all look very "bashy", and not like sage commands. Can I set an alias for a sage command? Like alias 'meh'='load("meh.sage")'
?
I have looked on this site, the "SAGE for newbies" document I found by Ted Kosan, doc.sagemath.org, and the general web, and I haven't found any documentation on aliases in sage.
When I run that, I get the following output:
sage: alias 'meh'='load("meh.sage")'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-118-7d3257e61ed9> in <module>()
----> 1 get_ipython().magic(u'alias \'meh\'=\'load("meh.sage")\'')
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2302 magic_name, _, magic_arg_s = arg_s.partition(' ')
2303 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2304 return self.run_line_magic(magic_name, magic_arg_s)
2305
2306 #-------------------------------------------------------------------------
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2223 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2224 with self.builtin_trap:
-> 2225 result = fn(*args,**kwargs)
2226 return result
2227
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magics/osm.pyc in alias(self, parameter_s)
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magics/osm.pyc in alias(self, parameter_s)
117 # Now try to define a new one
118 try:
--> 119 alias,cmd = par.split(None, 1)
120 except TypeError:
121 print(oinspect.getdoc(self.alias))
ValueError: need more than 1 value to unpack