The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 6,323β€…    Votes:  3β€…
Tags: command-line   bash   redirect  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/861522
Title: In what order does the shell execute commands and stream redirection?
ID: /2016/12/17/In-what-order-does-the-shell-execute-commands-and-stream-redirection_
Created: December 17, 2016
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


It’s always left to right… except when

Just like in Math we do left to right except multiplication and division is done before addition and subtraction, except operations inside parenthesis (+ -) would be done before multiplication and division.

As per the Bash beginners guide here (Bash Beginners Guide) there are 8 orders of hierarchy of what comes first (before left to right):

  1. Brace expansion β€œ{}”
  2. Tilde expansion β€œ~”
  3. Shell parameter and variable expression β€œ$”
  4. Command substitution β€œ$(command)”
  5. Arithmetic expression β€œ$((EXPRESSION))”
  6. Process Substitution what we are talking about here β€œ<(LIST)” or β€œ>(LIST)”
  7. Word Splitting β€œβ€™< space>< tab>< newline>’”
  8. File Name Expansion β€œ*”, β€œ?”, etc.

So it’s always left to right… except when…

⇧ Crontab not working @reboot with macchanger Bluetooth in Toshiba Satellite C845  β‡©