s.1 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .Dd May 05, 2016
  2. .Dt S 1
  3. .Os
  4. .Sh NAME
  5. .Nm s
  6. .Nd command line interpreter
  7. .Sh SYNOPSIS
  8. .Nm
  9. .Op Ar script
  10. .Sh DESCRIPTION
  11. .Nm s
  12. has two main modes of operation: interactive shell and batch script processor.
  13. If the command line argument
  14. .Ar script
  15. is provided it will execute that file. This also allows you to use
  16. .Nm s
  17. as the shebang line in an executable. Alternatively you can provide commands via stdin.
  18. Otherwise if you start
  19. .Nm s
  20. in a terminal you will be given an interactive shell prompt like this:
  21. .Bd -literal
  22. s$ echo hello world!
  23. hello world!
  24. .Ed
  25. .Pp
  26. .Sh SYNTAX
  27. The lexical syntax of the shell language is very strictly tokenized based on spaces. Variables may occur inside tokens with ${FOO} syntax, the {}'s are option.
  28. The
  29. .Em #
  30. character starts a comment until the end of the line.
  31. A token always stays a single token there is no globs or bash style expansion. You will need to master xargs to use this shell.
  32. .Sh GRAMMAR
  33. The grammar is line based. Sequences of tokens are treated as commands and the operators
  34. .Em "|"
  35. ,
  36. .Em &&
  37. and
  38. .Em ||
  39. are parsed in order of tightest binding first.
  40. At the end of a line you can specify that job should be run in the background with
  41. .Em &
  42. .Sh BUILTINS
  43. The builtins will print warnings when used interactively but print errors and exit immediately when used in a script.
  44. .Nm cd
  45. .Op Ar directory
  46. .Nm set
  47. .Ar variable
  48. .Ar value
  49. .Nm unset
  50. .Ar variable