Search results
Results from the WOW.Com Content Network
As far as I know, using & after the command is for running it in the background. Example of & usage: tar -czf file.tar.gz dirname & But how about &&? (example)
In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance, ./myprogram &; echo $! will return the PID of the process which backgrounded myprog...
The [[ ]] is treated specially by bash; consider that an augmented version of [ ] construct: [ ] is actually a shell built-in command, which, can actually be implemented as an external command. Look at your /usr/bin, there is most likely a program called "[" there! Strictly speaking, [ ] is not part of bash syntax.
From the manual: (acessible by calling man bash in your shell) Expands to the exit status of the most recently executed foreground pipeline. By convention an exit status of 0 means success, and non-zero return status means failure.
In bash these are implemented via temp files, usually in the form /tmp/sh-thd.<random string>, while in dash they are implemented as anonymous pipes. This can be observed via tracing system calls with strace command. Replace bash with sh to see how /bin/sh performs this redirection. $ strace -e open,dup2,pipe,write -f bash -c 'cat <<EOF > test ...
In bash, && and || have equal precendence and associate to the left. See Section 3.2.3 in the manual for details. So, your example is parsed as $ (echo this || echo that) && echo other And thus only the left-hand side of the or runs, since that succeeds the right-hand side doesn't need to run.
Yes. Please see the man page of Bash (the first thing you go to) under Special Parameters:. Special Parameters. The shell treats several parameters specially.
To summarize (non-exhaustively) bash's command operators/separators: | pipes (pipelines) the standard output (stdout) of one command into the standard input of another one. Note that stderr still goes into its default destination, whatever that happen to be. |&pipes both stdout and stderr of one command into the standard input of another one ...
If not quoted, it is a pattern match! (From the Bash man page: "Any part of the pattern may be quoted to force it to be matched as a string."). Here in Bash, the two statements yielding "yes" are pattern matching, other three are string equality:
In general, in bash and other shells, you escape special characters using \. So, when you use echo foo >\> what you are saying is "redirect to a file called >", but that is because you are escaping the second >. It is equivalent to using echo foo > \> which is the same as echo foo > '>'. So, yes, as Sirex said, that is likely a typo in your book.