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

Remove useless cat usage #49846

Closed
wants to merge 1 commit into from
Closed

Remove useless cat usage #49846

wants to merge 1 commit into from

Conversation

bebehei
Copy link

@bebehei bebehei commented Feb 20, 2025

Remove the useless redirection of cat.

Copy link

linux-foundation-easycla bot commented Feb 20, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 20, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @bebehei!

It looks like this is your first PR to kubernetes/website 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/website has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the language/en Issues or PRs related to English language label Feb 20, 2025
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 20, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign natalisucks for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

netlify bot commented Feb 20, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 2afb69a
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/67b749b4d7c9fc0008c2b973
😎 Deploy Preview https://deploy-preview-49846--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -62,7 +62,7 @@ To manually enable IPv4 packet forwarding:

```bash
# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
sudo tee /etc/sysctl.d/k8s.conf <<EOF
Copy link
Contributor

@bart0sh bart0sh Feb 20, 2025

Choose a reason for hiding this comment

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

nit:

Suggested change
sudo tee /etc/sysctl.d/k8s.conf <<EOF
echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/k8s.conf

Copy link
Author

Choose a reason for hiding this comment

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

Well then. Let's do it right in the right way 😄

Suggested change
sudo tee /etc/sysctl.d/k8s.conf <<EOF
sudo tee /etc/sysctl.d/k8s.conf <<<'net.ipv4.ip_forward = 1'

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 20, 2025
@bebehei
Copy link
Author

bebehei commented Feb 20, 2025

This doesn't seem to be the only use of cat <<EOF | <command>

I'll rework this tomorrow with a sed if no one is objecting in general.

[bebe:~/code/kubernetes/website] patch-1(+1/-3) ± git grep 'cat\s*<<EOF\s*|\s*[a-zA-Z0-9]' | wc -l
89
[bebe:~/code/kubernetes/website] patch-1(+1/-3) ± 

Copy link
Contributor

@sftim sftim left a comment

Choose a reason for hiding this comment

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

Honestly, I think the existing approach is easier to explain and learn, even if you can save a process. You don't even need tee here.

Folks who know Linux to work out the equivalent commands are welcome to do that; our audience includes people who can't.

@bebehei
Copy link
Author

bebehei commented Feb 22, 2025

@sftim thanks for your wise words.

Folks who know Linux to work out the equivalent commands are welcome to do that; our audience includes people who can't.

I acknowledge, there are parts of the audience, who do not understand the differences between the details we're talking about here in the PR. And I think we can agree, they do not need to understand.

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
<filecontents>
EOF
sudo tee /etc/sysctl.d/k8s.conf <<EOF
<filecontents>
EOF
cat > /etc/sysctl.d/k8s.conf <<EOF
<filecontents>
EOF

Honestly, I think the existing approach is easier to explain and learn, even if you can save a process.

I prefer readable commands, which are mostly copy-pastable and comprehensible. Having comprehensible commands serves all audiences of any experience level.

But how do you conclude, the first example is easier to comprehend than the second or the third?

@sftim
Copy link
Contributor

sftim commented Feb 23, 2025

But how do you conclude, the first example is easier to comprehend than the second or the third?

I've taught lots of people how to use Linux. I think the mental model people have to build for the first one is easiest.

@bebehei bebehei closed this Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants