-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUSAGE
77 lines (61 loc) · 2.86 KB
/
USAGE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
This is a pre alpha software, use it on your own risk. The most noteworthy
problem is that it's not kind to though who types in errors, the failures
are so badly handled that it can ruin the enclosing shell. But on the other
hand it can demo some of the features in the original scsh quite well.
To use it.
1. add this directory to guile's %load-path
2. use a module in the scsh directory that export a feature you would like to use
3. use it (prefereable correctly without errors or there will be dragons)
Example of Startup:
$ guile -L .
or
$ export GUILE_LOAD_PATH=`pwd`
$ guile
Example of running a command on background:
scheme@(guile-user)> (use-modules (scsh syntax))
scheme@(guile-user)> (& (| (ls) (grep COP)))
$4 = #{proc 3084}
scheme@(guile-user)> COPYING
More Examples:
scheme@(guile-user)> (define ls '(ls --color=auto))
scheme@(guile-user)> (run ,ls)
COPYING guile-scsh.scm scsh test USAGE
$3 = 0
Example on call/temp-file:
scheme@(guile-user)> (call/temp-file (lambda () (run (ls ) (= 1 (current-output-port)))) (lambda (x) (run (,@ls -l ,x))))
-rw------- 1 chaos chaos 44 Mar 6 15:41 /tmp/5310.61038
$12 = 0
Example on Globbing:
scheme@(guile-user)> (use-modules (scsh glob))
scheme@(guile-user)> (use-modules (scsh syntax))
scheme@(guile-user)> (glob /bin/l*)
$1 = ("/bin/lessecho" "/bin/lsblk" "/bin/lessfile" "/bin/ls" "/bin/lesskey" "/bin/login" "/bin/ln" "/bin/lowntfs-3g" "/bin/lsmod" "/bin/lesspipe" "/bin/loadkeys" "/bin/less")
scheme@(guile-user)> (run (ls . ,(glob /bin/l*)))
/bin/less /bin/lesskey /bin/loadkeys /bin/ls
/bin/lessecho /bin/lesspipe /bin/login /bin/lsblk
/bin/lessfile /bin/ln /bin/lowntfs-3g /bin/lsmod
$2 = 0
More Examle on Globbing:
scheme@(guile-user)> (define k "/bin/l*")
scheme@(guile-user)> (run (ls -l ,@(glob ,k)))
-rwxr-xr-x 1 root root 149384 Aug 11 2011 /bin/less
-rwxr-xr-x 1 root root 10368 Aug 11 2011 /bin/lessecho
lrwxrwxrwx 1 root root 8 Aug 11 2011 /bin/lessfile -> lesspipe
-rwxr-xr-x 1 root root 15824 Aug 11 2011 /bin/lesskey
-rwxr-xr-x 1 root root 7506 Aug 11 2011 /bin/lesspipe
-rwxr-xr-x 1 root root 47688 Nov 20 06:25 /bin/ln
-rwxr-xr-x 1 root root 111320 Apr 1 2012 /bin/loadkeys
-rwxr-xr-x 1 root root 44928 Sep 13 06:29 /bin/login
-rwxr-xr-x 1 root root 63888 Sep 11 12:12 /bin/lowntfs-3g
-rwxr-xr-x 1 root root 105840 Nov 20 06:25 /bin/ls
-rwxr-xr-x 1 root root 44640 Mar 30 2012 /bin/lsblk
-rwxr-xr-x 1 root root 6272 Nov 21 2011 /bin/lsmod
$3 = 0
Example on run-extras:
scheme@(guile-user)> (use-modules (scsh syntax) (scsh scsh) (ice-9 receive))
scheme@(guile-user)> (use-modules (scsh run-extras))
scheme@(guile-user)> (receive (status out err)
(run/collecting (1 2) (cat /usr/kmshea/mbox))
(list status (port->string out) (port->string err)))
$1 = (256 "" "cat: /usr/kmshea/mbox: No such file or directory\n")
*** Note: run-extras must be imported separately.