Skip to content

Concept: Redirections #736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 24, 2025
Merged

Concept: Redirections #736

merged 7 commits into from
Apr 24, 2025

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Apr 22, 2025

A lot of this text is AI generated.

@glennj glennj added the x:module/concept Work on Concepts label Apr 22, 2025
@glennj glennj marked this pull request as draft April 22, 2025 16:32
@glennj glennj requested a review from a team April 22, 2025 16:34
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good over all. Suggestions provided.


## Combining redirections

Multiple redirections can be given at once.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Multiple redirections can be given at once.
Multiple redirection can be given at once.

I believe this is more correct than using the plural, even here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. Singular sounds weird when following "multiple".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but it is a single concept, each redirection can be given multiple times.

* Purpose: Redirects the standard output (stdout) of a command to a file.
* Behavior:
* If the file doesn't exist, it's created.
* If the file exists, its contents are overwritten.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "overwritten" the same as "truncated"? Does overwritten imply that if the existing file in 10k and we write 1 byte, we only modify one byte?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The effect may be the same, while the work may be less to just overwrite the file. If we were to truncate, we would have to know information about the content of the file. To overwrite it we only need to know the name (the file system handles other technical aspects, such as managing fragmentation, etc.).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we can leave it as "overwritten" as it is effectively doing that, to completion. The technical details are a little deep and involves the media layer.

* Purpose: Appends the standard output (stdout) of a command to a file.
* Behavior:
* If the file doesn't exist, it's created.
* If the file exists, the output is added to the end of the file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If the file exists, the output is added to the end of the file.
* If the file exists, the output is appended to the end of the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but "added" is probably generally understood. Either word works, "added" is more common of a word.


### `2>` (Error Redirection):

* Purpose: Redirects the standard error (stderr) of a command to a file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Purpose: Redirects the standard error (stderr) of a command to a file.
* Purpose: Redirects the standard error (`stderr`) of a command to a file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Singluar "Redirect" being my suggestion, but I like the code formatting of the stderr here.

@glennj glennj requested review from kotp and IsaacG April 23, 2025 19:10
@glennj glennj marked this pull request as ready for review April 23, 2025 20:09
@glennj glennj force-pushed the concept-redirection branch from 3d2b543 to adf8673 Compare April 23, 2025 20:16
@glennj glennj merged commit bcb74ca into exercism:main Apr 24, 2025
2 checks passed
@glennj glennj deleted the concept-redirection branch April 24, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:module/concept Work on Concepts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants