Skip to content
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

Use $(< file) instead of $(cat file) #264

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

akihiro17
Copy link
Contributor

@akihiro17 akihiro17 commented Jul 2, 2024

I think it's better to use $(< file) instead of $(cat file)

ref. https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html

The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

@Mte90 Mte90 self-requested a review July 2, 2024 15:25
Copy link
Member

@Mte90 Mte90 left a comment

Choose a reason for hiding this comment

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

Tested with shellcheck and it is valid bash:

#!/usr/bin/bash

echo $(< "test")

I learned something new but it is better as it is pure bash.

Copy link
Collaborator

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

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

I learned something new as well! Great PR

@Ph0enixKM Ph0enixKM merged commit 346b90e into amber-lang:master Jul 2, 2024
1 check passed
@akihiro17 akihiro17 deleted the redirect-instead-of-cat branch July 3, 2024 03:23
Mte90 pushed a commit to Mte90/Amber that referenced this pull request Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants