aliases 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. keywords : aliases
  2. info :~
  3. Usage:
  4. alias list current aliases
  5. alias <command> <format> assign a new alias to the given command
  6. alias <command> delete an existing alias
  7. Aliases are used to restring one command into another command. Aliases can
  8. take arguments, and they can also reference other aliases. If you would like
  9. to make an alias take arguments, you must use $1, $2, ... $9 in the alias
  10. format, where the number specifies which word in a list of arguments the
  11. argument will expand to.
  12. Example:
  13. > alias dyslexia say $2 $1
  14. Alias set.
  15. > dyslexia hello, world!
  16. You say, 'world! hello,'
  17. In addition to the $1, $2, ... $9 arguments, there is also a catch-all $*
  18. argument which means "all of the arguments together".
  19. Example:
  20. > alias chat chat --> $* <--
  21. Alias set.
  22. > chat hello, world!
  23. You chat, '--> hello, world! <--'
  24. Notice that in the above example, even though the alias called itself, the
  25. normal 'chat' command still executed? This is because when an alias is
  26. executed, it tells the mud it does not need to expand aliases any more. If
  27. you would like to embed an alias within another alias, you have to put square
  28. brackets around it. Like normal aliases, these embedded aliases can also take
  29. arguments by putting them within the square brackets as well.
  30. Example:
  31. > alias greeting hello
  32. Alias set.
  33. > alias greet [chat [greeting], $*! How are you?]
  34. Alias set.
  35. > greet world
  36. You chat, '--> hello, world! How are you? <--'
  37. You can also set up aliases to perform multiple commands. Each command must
  38. be separated by a semicolon.
  39. Example:
  40. > alias multigreet [chat [greeting], $*!]; [chat How are you?]
  41. Alias set.
  42. > multigreet world
  43. You chat, '--> hello, world! <--'
  44. >
  45. You chat, '--> How are you? <--'
  46. -