Add idea about turning functions into scripts

master
Jacopo De Simoi 2 years ago
parent 033babcfbd
commit 089fc6fff3
  1. 23
      zshrc.org

@ -57,6 +57,29 @@ defined in the previous section.
*** TODO replace pomodoro aliases with actual scripts
*** TODO have a look at this idea:
Instead of defining a lot of functions in your `.zshrc', all of which you may not use, it is often better to use the autoload builtin. The idea is, you create a directory where function definitions are stored, declare the names in your `.zshrc', and tell the shell where to look for them. Whenever you reference a function, the shell will automatically load it into memory.
% mkdir /tmp/funs
% cat >/tmp/funs/yp
ypmatch $1 passwd.byname
^D
% cat >/tmp/funs/cx
chmod +x $*
^D
% FPATH=/tmp/funs
% autoload cx yp
% functions cx yp
undefined cx ()
undefined yp ()
% chmod 755 /tmp/funs/{cx,yp}
% yp egsirer
egsirer:*:3214:35:Emin Gun Sirer:/u/egsirer:/bin/sh
% functions yp
yp () {
ypmatch $1 passwd.byname
}
*** Include :daily:android:
First, include a script that sets a number of confidential data (e.g. API keys and such)
#+begin_src sh

Loading…
Cancel
Save