12.07.2015 Views

spec - Local Sector 7 web page

spec - Local Sector 7 web page

spec - Local Sector 7 web page

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Utility MacrosUNIX CommandsThese simple macros are for commonly used UNIX commands.def cd ’chdir("$*")’ # Change working directorydef pwd ’print CWD’ # Print working directorydef u ’unix("$*")’ # Execute arbitrary shell commandsdef ls ’unix("ls $*")’ # List filesdef l ’unix("ls -l $*")’ # Long listing of filesdef cat ’unix("cat $*")’ # Show file contentsdef less ’unix("less $*")’ # Peruse files with handy utilitydef mail ’unix(sprintf("%s $*", MAIL))’ # Send maildef ed ’unix("ed $*")’ # Invoke an editordef ned ’unix("ned $*")’ # Invoke another editordef vi ’unix("vi $*")’ # Invoke another editorThe u macro, without arguments, spawns an interactive subshell, using your SHELLenvironment variable.Note how the above macros supply parentheses and quotation marks around thearguments, as required by the parser’s grammar rules.Basic AliasesThe main purpose of these macros is to provide a shorthand way of typing some usefulcommands.def d ’print date()’ # Print current time and datedef p ’print’ # Shorthand for printdef h ’help’ # Shorthand for help, belowdef hi ’history’ # Shorthand for historydef beep ’printf("\a")’ # Sound the belldef cl ’tty_cntl("cl")’ # Clear the screendef com ’comment "$*"’ # Shorthand for comment, belowdef ond ’if (DATAFILE) # Send output to data file{ on(DATAFILE) }’def offd ’if (DATAFILE) # Stop sending{ off(DATAFILE)’def onp ’if (PRINTER) # Send output to the printer{ on(PRINTER) }’def offp ’if (PRINTER != "") # Stop sending{ off(PRINTER) }’def ont ’on("tty")’ # Send output to the terminaldef offt ’off("tty")’ # Stop sendingdef fon ’if ($# == 1) on("$1")else { print "Usage: fon filename"; on(); }’def foff ’if ($# == 1) off("$1")INTERIM WORK-IN-PROGRESS (8/16/01) NOT FOR GENERAL DISTRIBUTION STANDARD MACRO GUIDE 127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!