Skip to main content
40 events
when toggle format what by license comment
Mar 15, 2023 at 11:53 comment added Imran When you're using &, you should be aware that ctrl + c only stops last command, other commands run in the background and you've to manually find and kill the processes.
Sep 30, 2021 at 13:13 history edited ilkkachu CC BY-SA 4.0
added 23 characters in body
Jun 24, 2020 at 16:13 comment added terdon @felwithe essentially, yes. In fact, you very rarely (if ever) need cat file | command, this is a classic example of UUoC (useless use of cat).
Jun 24, 2020 at 15:54 comment added felwithe So command < file.txt is the same as cat file.txt | command?
Jun 6, 2020 at 16:16 history rollback terdon
Rollback to Revision 18
Jun 6, 2020 at 16:03 history rollback terdon
Rollback to Revision 16
Jun 6, 2020 at 16:01 history edited user232326 CC BY-SA 4.0
deleted 166 characters in body
Jun 6, 2020 at 15:38 history edited user232326 CC BY-SA 4.0
Extended description of `>&` and `&>` redirection.
Jun 3, 2020 at 19:07 history edited Gilles 'SO- stop being evil' CC BY-SA 4.0
https://unix.stackexchange.com/questions/590694/posix-compliant-way-to-redirect-stdout-and-stderr-to-a-file
Jun 25, 2019 at 20:03 history edited user232326 CC BY-SA 4.0
Correct `!` description. Links to operators (redirection and control) reference in the posix spec.
Mar 8, 2019 at 4:40 comment added Stilez Can this excellent answer be edited to clarify one small aspect of redirects: Is there actually any difference between cmd1 | cmd2 and cmd2 < $( cmd1 )? Why are there two ways, syntactically, to direct stdin from one process to another, and when do shell scripts tend to use one or the other? Are there any commonly-encountered limitations in other usual syntax + operators one can use, or any common confusions, caused by the "<" appearing after the command it's directing into?
May 22, 2018 at 19:12 comment added Amit Naidu There's also the >! analogue of >| to be aware of, in some non-bash shells.
Dec 11, 2017 at 22:06 comment added G-Man Says 'Reinstate Monica' It should be noted that these symbols lose their special meaning and become ordinary textual characters when they are quoted (with '' or "") or escaped (with \); e.g., echo 'Tom & Jerry' or grep \< prog.c. Bash, specifically, also supports a $'' syntax. These quoting methods — '' and "" (and $'') — differ in ways that are discussed elsewhere.
Sep 15, 2017 at 14:54 comment added terdon @Arc676 No, they don't evaluate to true or false, that's a completely different context. This just means that an exit value of non-0 indicates a problem (not false) and an exit code of 0 indicates success (not true). That's always been the way and is quite standard. A non-0 exit code indicates an error in every environment I know of.
Sep 15, 2017 at 14:42 comment added Arc676 The && and || uses seem counterintuitive. Doesn't this mean that exit code 0 evaluates to True and non-zero evaluates to False?
May 23, 2017 at 12:40 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Apr 13, 2017 at 12:37 history edited CommunityBot
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
S Mar 19, 2017 at 16:02 history suggested Moshe CC BY-SA 3.0
fix var to foo
Mar 19, 2017 at 15:27 review Suggested edits
S Mar 19, 2017 at 16:02
Aug 4, 2016 at 11:08 history edited cas CC BY-SA 3.0
added info about piping from herenow docs
Dec 22, 2015 at 13:15 history edited Stéphane Chazelas CC BY-SA 3.0
added 203 characters in body
Jun 25, 2015 at 11:32 history edited Stéphane Chazelas CC BY-SA 3.0
added 818 characters in body
May 4, 2015 at 14:17 vote accept terdon
Mar 11, 2015 at 7:29 comment added mikeserv @hildred - I dunno. Maybe I was just trying to be thorough...? More likely it was a typo. Sorry to disappoint...
Mar 11, 2015 at 5:06 comment added hildred @mikeserv >>> ? what does that do? where can I find out more about it? I know that you are not talking about >> which is standard.
Nov 29, 2014 at 16:48 history edited Stéphane Chazelas CC BY-SA 3.0
There's no `>>(:)` just `>` redirection to a `>(...)` process substitution.
Nov 22, 2014 at 15:45 history edited terdon CC BY-SA 3.0
added 5 characters in body
Nov 4, 2014 at 14:50 history edited Kimmax CC BY-SA 3.0
corrected 2x "command1" where "command" should stand
Oct 6, 2014 at 23:33 history edited mikeserv CC BY-SA 3.0
added 529 characters in body
Oct 6, 2014 at 20:11 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
added 164 characters in body
Oct 6, 2014 at 20:02 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
indicate which operators are available only in some shells; group the sentence punctuation operators; link to my well-appreciated answer on brackets; show equivalences of && and ||; mention !; mention >|; mention process substitution
Oct 6, 2014 at 19:07 history made wiki Post Made Community Wiki by terdon
Oct 6, 2014 at 4:52 comment added user44370 This may help with the comparative angle.
Oct 6, 2014 at 3:29 comment added mikeserv And ksh93, yash, mksh, and many others. But they will all likely operate slightly differently in edge-cases between shells - thats why these types of things are iffy.
Oct 6, 2014 at 3:26 comment added terdon @mikeserv thanks. They work on bash and zsh though. I don't know what, if anything, is truly bash-specific in that list. I should go through this and add the shells each works in but that would involve finding out first.
Oct 6, 2014 at 3:23 comment added mikeserv &>, >>>, and <<< are all non-posix as is the reference to not-only non-alphanum chars in a here-doc's name. This answer also discusses very little about how they work - for example, it is almost worse than useless to talk about a simple command and a command without explaining what these are and how the shell decides.
Oct 6, 2014 at 2:51 comment added terdon @GregHewgill yeah, I weaseled out of it by saying that I am discussing with respect to bash. This is being groomed as a canonical Q&A to close the various "What does this weird thingy do" questions and most of them are from users of bash. I'm hoping someone else will pitch in and answer for non bash shells, but highlighting the bash-specific ones makes a lot of sense. I'll have to check though, I don't know which they are off the top of my head.
Oct 6, 2014 at 2:34 comment added Greg Hewgill It would probably be worthwhile noting that not all shells are equal, and specifically highlighting the bash-specific features.
Oct 6, 2014 at 2:25 history edited terdon CC BY-SA 3.0
added 3 characters in body
Oct 6, 2014 at 2:18 history answered terdon CC BY-SA 3.0