dwmkerr / dwmkerr/effective-shell

bug: backup-config.sh uses CRLF

Open
#384 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
780
Forks
93
Avg merge
1d 7h
Merged PRs (30d)
3

Description

## The problem
[backup-config.sh](https://github.com/dwmkerr/effective-shell/blob/main/samples/scripts/backup-config.sh) uses CRLF, which messes up [the operations in Chapter 7](https://effective-shell.com/part-3-manipulating-text/advanced-text-manipulation/#appending-text) on linux:
```
$ sed -E -e '/^cp/s/$/ || true/' backup-config.sh
#!/usr/bin/env bash

# Make sure you have a backup directory.
mkdir ~/backup

# Copy over alicloud, aws, azure, gcp, and ssh config and credentials.
|| trueiyun/config.json ~/backup/settings/aliyun/
|| trues/config ~/backup/settings/aws/
|| trues/credentials ~/backup/settings/aws/
|| trueure/config ~/backup/settings/azure/
|| truenfig/gcloud/credentials.db ~/backup/settings/gcloud/
|| trueh/config ~/backup/settings/ssh/
|| trueh/id_rsa ~/backup/settings/ssh/ # Is this safe?
|| trueh/id_rsa.pub ~/backup/settings/ssh/
```
I believe this is unintended because every other file in the directory uses LF.
## My solution
Change line endings to LF, with a tool like `dos2unix` or similar.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.