Skip to content

Commit

Permalink
päivitetty guidea
Browse files Browse the repository at this point in the history
  • Loading branch information
fergusq committed Feb 15, 2017
1 parent b6c48f9 commit 2e0c41c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ done
```

Like in Bourne shell, condition is a command. It can be an arithmetic command `[]` or a normal function call like below.
`file :e` is used to check if the file exists.
`fileExists` is used to check if the file exists.

```sh
if file :e, "log.txt" do
exec "rm", "log.txt"
if fileExists "log.txt" do
{} | exec "rm", "log.txt" | {}
done
```
Expand Down Expand Up @@ -109,7 +109,7 @@ Examples:
```sh
names := [get_name(client) for client in clients]
adults := [push(client) for client in clients if [ client.age >= 18 ]]
pwdir := !pwd
pwdir := pwd()
directories := [push(pwdir.."/"..f) for f in files if isDirectory(f)]
```
Expand All @@ -118,8 +118,8 @@ directories := [push(pwdir.."/"..f) for f in files if isDirectory(f)]
`for` can also used in pipes. `if` and `unless` are right-associative, so braces `{}` should be used around them.
```ruby
["Pictures/", "Music/"] | exec(:l, "ls", dir) for dir | { [ f ] for f unless isDirectory(f) } | for f do
print f.." "..file(:m, f)
["Pictures/", "Music/"] | bufferedExec("ls", dir) for dir | { [ f ] for f unless isDirectory(f) } | for f do
print f.." "..mimeType(f)
done
```
Expand All @@ -134,7 +134,7 @@ done
Ensures that the condition is true for all elements in list.
```sh
if isDirectory(f) for f in [exec(:l, "ls")] do
if isDirectory(f) for f in [ls(".")] do
print "All files are directories!"
done
```

0 comments on commit 2e0c41c

Please sign in to comment.