this post was submitted on 17 Mar 2024
667 points (100.0% liked)

Programmer Humor

421 readers
43 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] bjoern_tantau@swg-empire.de 92 points 8 months ago (31 children)

Does anyone actually use touch for its intended purpose? Must be up there with cat.

[–] noproblemmy@programming.dev 8 points 8 months ago (1 children)

cat

Ahhhhh, fuck. I'm quite noob with linux. I got into some rabbit hole trying to read the docs. I found 2 man pages, one is cat(1) and the other cat(1p). Apparently the 1p is for POSIX.

If someone could help me understand... As far as I could understand I would normally be concerned with (1), but what would I need to be doing to be affected by (1p)?

[–] survivalmachine 7 points 8 months ago* (last edited 8 months ago)

The POSIX standard is more portable. If you are writing scripts for your system, you can use the full features in the main man pages. If you are writing code that you want to run on other Linux systems, maybe with reduced feature sets like a tiny embedded computer or alternates to gnu tools like alpine linux, or even other unixes like the BSDs, you will have a better time if you limit yourself to POSIX-compatible features and options -- any POSIX-compatible Unix-like implementation should be able to run POSIX-compliant code.

This is also why many shell scripts will call #!/bin/sh instead of #!/bin/bash -- sh is more likely to be available on tinier systems than bash.

If you are just writing scripts and commands for your own purposes, or you know they will only be used on full-feature distributions, it's often simpler and more comfortable to use all of the advanced features available on your system.

load more comments (29 replies)