Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Automated dump
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jun 20, 2023
1 parent 97a7c6a commit aea43b3
Show file tree
Hide file tree
Showing 6 changed files with 1,400 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Bash

[Conditions](Bash%20cd7f5163fd214780904b27a1b8049e60/Conditions%2072281a0500924f8d95b56288d02efc68.md)
[Conditions](Bash%20cd7f5163fd214780904b27a1b8049e60/Conditions%2072281a0500924f8d95b56288d02efc68.md)

[StdOut / StdIn Piping](Bash%20cd7f5163fd214780904b27a1b8049e60/StdOut%20StdIn%20Piping%20910e23eb8f874e74b8b66265a9a78326.md)

[Function Returns](Bash%20cd7f5163fd214780904b27a1b8049e60/Function%20Returns%20e6c70228b89e4ec5a01feddc6a798677.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Function Returns

Here is a simple example of a bash function returning a boolean.

```bash
function find_gofiles() {
for dir in ${GOFILE_DIRS[*]}; do
[ -n "$(find $dir -iname '**.go' 2> /dev/null)" ] && {
# Store result in a variable
GOFILES_DIR=$dir
return 0 # ~ true
}
done

return 1 # ~ false
}

find_gofiles && echo "Found in ${GOFILES_DIR}!"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# StdOut / StdIn Piping

- Pipe only StdErr

```bash
find doesnotexist 2> /dev/null
```

- Pipe both StdErr and StdOut

```bash
find doesnotexist > /dev/null 2>&1
```
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@
background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%220.75%22%20y%3D%220.75%22%20width%3D%2214.5%22%20height%3D%2214.5%22%20fill%3D%22white%22%20stroke%3D%22%2336352F%22%20stroke-width%3D%221.5%22%2F%3E%0A%3C%2Fsvg%3E");
}

</style></head><body><article id="cd7f5163-fd21-4780-904b-27a1b8049e60" class="page sans"><header><h1 class="page-title">Bash</h1><p class="page-description"></p></header><div class="page-body"><figure id="72281a05-0092-4f8d-95b5-6288d02efc68" class="link-to-page"><a href="Bash%20cd7f5163fd214780904b27a1b8049e60/Conditions%2072281a0500924f8d95b56288d02efc68.html">Conditions</a></figure></div></article></body></html>
</style></head><body><article id="cd7f5163-fd21-4780-904b-27a1b8049e60" class="page sans"><header><h1 class="page-title">Bash</h1><p class="page-description"></p></header><div class="page-body"><figure id="72281a05-0092-4f8d-95b5-6288d02efc68" class="link-to-page"><a href="Bash%20cd7f5163fd214780904b27a1b8049e60/Conditions%2072281a0500924f8d95b56288d02efc68.html">Conditions</a></figure><figure id="910e23eb-8f87-4e74-b8b6-6265a9a78326" class="link-to-page"><a href="Bash%20cd7f5163fd214780904b27a1b8049e60/StdOut%20StdIn%20Piping%20910e23eb8f874e74b8b66265a9a78326.html">StdOut / StdIn Piping</a></figure><figure id="e6c70228-b89e-4ec5-a01f-eddc6a798677" class="link-to-page"><a href="Bash%20cd7f5163fd214780904b27a1b8049e60/Function%20Returns%20e6c70228b89e4ec5a01feddc6a798677.html">Function Returns</a></figure></div></article></body></html>
Loading

0 comments on commit aea43b3

Please sign in to comment.