Skip to content

Commit

Permalink
[Bash] Write variable to file
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Aug 12, 2023
1 parent 02cc5a7 commit 7b2f788
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,23 @@ set -euo pipefail
```
[🔗](https://explainshell.com/explain?cmd=set+-euo+pipefail)
### Write variable to file
```bash title="echo"
echo "$var" > out.txt
```
```bash title="printf"
printf "%s\n" "$var" > out.txt
```
```bash title="here string"
cat <<< "$var" > out.txt
```
```bash title="here doc"
cat << EOF > out.txt
$var
EOF
```

0 comments on commit 7b2f788

Please sign in to comment.