Skip to main content
15 events
when toggle format what by license comment
Apr 7, 2021 at 14:00 history rollback Pourko
Rollback to Revision 6
Apr 7, 2021 at 13:57 history edited Pourko CC BY-SA 4.0
deleted 26 characters in body
Apr 5, 2021 at 5:25 history edited Pourko CC BY-SA 4.0
deleted 7 characters in body
Mar 21, 2021 at 12:39 history edited ilkkachu CC BY-SA 4.0
I don't think I suggested that. No need to mark edits as edits, it's confusing for any readers who haven't seen the original. And those who have, can note the changes and recheck the revision history if they care
Mar 21, 2021 at 10:15 history edited Pourko CC BY-SA 4.0
added 4 characters in body; added 1 character in body
Mar 21, 2021 at 10:03 history edited Pourko CC BY-SA 4.0
added 219 characters in body; deleted 8 characters in body
Mar 21, 2021 at 8:38 comment added ilkkachu @BrianDrake the man page probably describes the external version of [. It probably doesn't have -v because it would not be nearly as useful in an external program than in a shell builtin. In Bash, use help test. Also see e.g. How do I know if the man page I'm looking at is the correct one?
Mar 21, 2021 at 8:32 comment added Kusalananda @BrianDrake Running bash in POSIX mode does not disable all non-POSIX features. The fact that [[ works in POSIX mode in bash does not mean that [[ is a POSIX feature. The fact that it's not mentioned in the POSIX standard (other than "causing unspecified result") means it's not a POSIX feature. It's allowed to be interpreted (in an unspecified way) by a shell running in POSIX mode.
Mar 21, 2021 at 8:19 comment added Peter Cordes @BrianDrake: [[ is part of the shell grammar so it can affect how var expansion works inside it, making it more robust for some cases with vars whole value is -n for example, and allowing other features; I forget all the details of why it's better. [ is "just" a command.
Mar 21, 2021 at 4:56 history edited Pourko CC BY-SA 4.0
added 4 characters in body
Mar 21, 2021 at 4:49 comment added Brian Drake Anyway, both [ and [[ work in bash --posix. Perhaps my new question should be: Why did you mention Bash at all? The question asked for a shell-agnostic answer.
Mar 21, 2021 at 4:39 comment added Brian Drake From reading the bash manpage more carefully, it turns out that it has its own version of [, which supports the same tests as [[. I do not understand why there are two forms, nor how POSIX-compatible either of them is.
Mar 21, 2021 at 4:26 comment added Pourko @Brian Drake: Did you try it? I never had a reason to look into [[.
Mar 21, 2021 at 4:22 comment added Brian Drake Did you mean [[ instead of [? Your answer mentions Bash and according to the manpage [(1) on my system, there is no -v test.
Mar 21, 2021 at 4:08 history answered Pourko CC BY-SA 4.0